For the latest stable version, please use Emilua API 0.10! |
http.request
The http module is experimental.
|
Represents an HTTP request. This extra level of indirection — as opposed to as,
for instance, making it part of http.socket
— makes it easier to map
semantics such as HTTP pipelining w/o imposing even more confusing state
machines.
Functions
continue_required(req: http.request) → boolean
Check if the request represented by req
requires a “100 (Continue) response”
[1].
If you can properly process and reply the message without its body, you’re free to go. Otherwise, you should send a “100 (Continue) response” to ask for the message body from the HTTP client.
This feature was designed to decrease network traffic, by allowing servers to sooner reject messages that would be discarded anyway.
The name required is used instead supported, because an action from the server is required.
upgrade_desired(req: http.request) → boolean
Check if the client desires to initiate a protocol upgrade.
The desired protocols are present in the "upgrade"
header as a comma-separated
list.
You MUST NOT upgrade to a protocol listed in the "upgrade" header
if this function returns false .
|
The upgrade desire can always be safely ignored.
The user MUST wait till the whole request is received before proceeding to the protocol upgrade.