Welcome to the CHICKEN Scheme pasting service

https pasted by S-liao on Tue Feb 18 14:25:10 2025

(import (chicken base))
(import (chicken io))
(import (chicken tcp))
(import http-client)
(import intarweb)
(import openssl)
(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) (receive (in out)
                   (ssl-connect* hostname: (uri-host remote-end)
                                 port: (uri-port remote-end)
                                 sni-name: #t
                                 verify?: #t) ; accept invalid certs
                 (values in out)))
      (else (error "Unsupported protocol" (uri-scheme remote-end))))))


(server-connector http-server-connector)

(define url "https://repology.org")
(print (with-input-from-request url #f read-string))

Adding protocol added by sjamaan on Tue Feb 18 14:41:06 2025

(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)
                                 sni-name: #t
                                 protocol: 'tlsv13
                                 verify?: #t) ; accept invalid certs
                 (values in out)))
      (else (error "Unsupported protocol" (uri-scheme remote-end))))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which relatively recent Scheme report version does CHICKEN _not_ implement?
Visually impaired? Let me spell it for you (wav file) download WAV