HTTP client


The http.client vocabulary implements an HTTP and HTTPS client on top of HTTP protocol objects.

For HTTPS support, you must load the io.sockets.secure vocab first. If you don't need HTTPS support, don't load io.sockets.secure; this will reduce the size of images generated by tools.deploy.

There are two primary usage patterns, data retrieval with GET requests and form submission with POST requests:
GET requests with the HTTP client
POST requests with the HTTP client
PUT requests with the HTTP client

Submission data for POST and PUT requests:
HTTP client post data

Other HTTP methods are also supported:
HEAD requests with the HTTP client
DELETE requests with the HTTP client
OPTIONS requests with the HTTP client
TRACE requests with the HTTP client

More esoteric use-cases, for example HTTP methods other than the above, are accommodated by constructing an empty request object with <request> and filling everything in by hand.
Character encodings and the HTTP client
HTTP client errors

For authentication, only Basic Access Authentication is implemented, using the username/password from the target or proxy url. Alternatively, the set-basic-auth or set-proxy-basic-auth words can be called on the request object.

The http client can use an HTTP proxy transparently, by using the HTTP(S) proxy variables. Additionally, the proxy variables can be ignored by setting the proxy-url slot of each request manually:
Setting proxy-url to f prevents http.client from using a proxy.
Setting the slots of the default empty url in proxy-url overrides the corresponding values from the proxy variables.


See also
URL objects