1 HTTP Client
Identifies an HTTP connection.
Identifies an HTTP connection that is "live", i.e. one for which
Returns a fresh HTTP connection.
to connect to host
on port port
using SSL if ssl?
is not #f
an argument to ssl-connect
to, for example, check
If hc is live, the connection is closed.
Closes hc if it is live.
Closes the output side of hc, if it is live.
Sends an HTTP request to hc
to the URI uri
HTTP version version
, the method method
, and the
additional headers given in headers
and the additional data
. If method
), provide the same method
when calling http-conn-recv!
to avoid attempting to receive content.
If data is a procedure, it will be called once with a
procedure of one argument, which is a string or
byte string to be written to the request body using
chunked transfer encoding.
If headers does not contain an Accept-Encoding
header, then a header indicating that encodings from decodes
are accepted is automatically added.
If close? is #t and headers does not
contain a Connection header, then a Connection: close header will be added.
This function does not support requests that expect
100 (Continue) responses.
Parses an HTTP response from hc for the method
method while decoding the encodings listed in
Returns the status line, a list of headers, and an port which contains
the contents of the response. The port’s content must be consumed
before the connection is used further.
If close? is #t, then the connection will be closed
following the response parsing. If close? is #f,
then the connection is only closed if the server instructs the client
to do so.
Changed in version 126.96.36.199 of package base: Added the #:method argument.
The HTTP connection is not returned, so it is always closed after one
response, which is why there is no #:closed? argument like
1.1 Troubleshooting and Tips
1.1.1 How do I send properly formatted POST form requests?
You should send a Content-Type header with the value
application/x-www-form-urlencoded and send the data
formatted by net/uri-codec’s
form-urlencoded-encode function. For example,
| hc "/login"|
| #:method "POST"|
| (list (cons 'username "Ryu")|
| (cons 'password "Sheng Long")))|
| #:headers (list "Content-Type: application/x-www-form-urlencoded"))|