openssl: ignoring EOF with http-client added by wasamasa on Sat Feb 4 18:29:34 2023

(import (chicken io))
(import (chicken tcp))
(import (srfi 18))
(import (openssl socket))
(import http-client)
(import uri-common)

(define (http-server-connector uri proxy)
  (let ((remote-end (or proxy uri)))
    (case (uri-scheme remote-end)
      ((#f http) (tcp-connect (uri-host remote-end) (uri-port remote-end)))
      ((https) (ssl-connect* hostname: (uri-host remote-end)
                             port: (uri-port remote-end)
                             protocol: (cons 'tlsv12 ssl-max-protocol)
                             sni-name: #t
                             ignore-unexpected-eof?: #t))
      (else (error "Unsupported protocol" (uri-scheme remote-end))))))

(server-connector http-server-connector)

(let loop ()
  (with-input-from-request "https://eggs.call-cc.org/rss-5.xml" #f read-string)
  (thread-sleep! 0.1)
  (loop))