4

How do I make https requests using Guile? I make plain http requests using web client

(http-get "http://example.com" #:streaming? #t)

When I try to make https requests the same way, though, I get the

400 The plain HTTP request was sent to HTTPS port

error.

Sergo Pasoevi
  • 2,833
  • 3
  • 27
  • 41

1 Answers1

1

The bad news is that, by default, the web client package does not support HTTPS. If you check the source code of the open-socket-for-uri procedure it is clear that only "plain" HTTP is supported.

The good news is that you can specify the #:port parameter to http-get (and all of the http-* methods) to pass a TLS-encrypted I/O port. GnuTLS-Guile provides a mechanism to very easily create a TLS-encrypted socket as a Scheme I/O port.

stiabhan
  • 381
  • 1
  • 5