(import openssl) (import http-client) (import uri-common) (import (chicken io)) (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) (receive (in out) (ssl-connect* hostname: (uri-host remote-end) port: (uri-port remote-end) protocol: 'tlsv12 ;; protocol: '(tlsv1 . tlsv12) sni-name: #t verify?: #f) (if (and in out) ; Ugly, but necessary (values in out) (error "You forgot to install the openssl egg.")))) (else (error "This shouldn't happen"))))) (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)