(import (chicken io)) (import (chicken tcp)) (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: 'tlsv12 ;; protocol: '(tlsv12 . tlsv12) ;; protocol: '(tlsv12 . tlsv13) protocol: (cons 'tlsv12 ssl-max-protocol) sni-name: #t verify?: #f)) (else (error "Unsupported protocol" (uri-scheme remote-end)))))) (server-connector http-server-connector) ;; supports TLSv1.2 and v1.3 only (with-input-from-request "https://en.wikipedia.org/wiki/Cat" #f read-string) ;; supports TLSv1.2 only (with-input-from-request "https://heise.de" #f read-string)