Welcome to the CHICKEN Scheme pasting service

HTTP requests over IPv6 added by teiresias on Thu Aug 11 04:37:04 2022

(import (chicken string) tcp6 http-client openssl uri-common)

;; This is mostly a straight cut and paste of default-server-connector
;; from http-client.  It works because tcp-connect is the
;; one from tcp6.

(define (ipv6-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)
                                 sni-name: #t)
                 (if (and in out)       ; Ugly, but necessary
                     (values in out)
                     (error
                      'ssl-connect
                      (conc "Unable to connect over HTTPS. To fix this, "
                            "install the openssl egg and try again")
                      (list (uri->string uri))
                      'missing-openssl-egg
                      'request-uri uri 'proxy proxy))))
      (else (error 'ensure-connection!
                               "Unknown URI scheme"
                               (list (uri-scheme remote-end))
                               'unsupported-uri-scheme
                               'uri-scheme (uri-scheme remote-end)
                               'request-uri uri 'proxy proxy)))))

(server-connector ipv6-server-connector)

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the R5RS procedure to access the second element of a pair?
Visually impaired? Let me spell it for you (wav file) download WAV