[det]http_read_data(+Request,
-Data, +Options)Read data from an HTTP connection and convert it according to the
supplied to(Format) option or based on the Content-type
in the Request. The following options are supported:
- to(Format)
- Convert data into Format. Values are:
stream(+WriteStream)) Append the content of the message
to Stream
- atom Return the reply as an atom
- string Return the reply as a string
- codes Return the reply as a list of codes
- form_data(AsForm)
- input_encoding(+Encoding)
- on_filename(:CallBack)
- These options are implemented by the plugin
library(http/http_multipart_plugin) and apply to processing
multipart/form-data content.
- content_type(+Type)
- Overrule the content-type that is part of Request as a
work-around for wrongly configured servers.
- max_request_size(+Bytes)
- Raise an exception if the body is larger than Bytes. Bytes
is a non-negative integer or
infinite. If Request
is an HTTP request (rather than a reply), the default is the setting http:max_request_size,
which is 10Mb (10,485,760 bytes). The HTTP server maps the exception to
a ‘413 Payload Too Large` reply. Note that this also limits file
uploads using multipart/form-data.
Without plugins, this predicate handles
- application/x-www-form-urlencoded
- Converts form-data into a list of
Name=Value terms.
- application/x-prolog
- Converts data into a Prolog term.
| Request | is a parsed HTTP request as returned
by
http_read_request/2 or
available from the HTTP server's request dispatcher. Request
must contain a term input(In) that provides the input
stream from the HTTP server. |
- Modified in 10.1.21 (👉8b0eaec) http_read_data/3: limit the size of request bodies