Appends a response head and returns how the body must be sent (see write_request_head).
body_length is the length of the body the response is for; for a HEAD response (set
request_method) it only fills in Content-Length, and nothing may be sent after the head. 1xx,
204 and CONNECT 2xx responses get no framing headers. A length of -1 means unknown: chunked on
HTTP/1.1, and for HTTP/1.0 the body ends when the connection closes (Connection: close is
added and the caller must close).
- out: the buffer the head is appended to.
- status: the status code.
- headers: sent as given. Framing headers are added for you, so passing one is an error.
- body_length: the body size in bytes, 0 for none, or -1 when it is not known yet.
- options: version, reason phrase, request method, keep-alive, and the
DateandServervalues.
write_response_head :: (
out: *[..] u8,
status: int,
headers: [] Header_Field,
body_length: s64,
options := Response_Options.{}
) -> (Body_Kind, bool)
Appends a response head and returns how the body must be sent (see write_request_head).
body_length is the length of the body the response is for; for a HEAD response (set
request_method) it only fills in Content-Length, and nothing may be sent after the head. 1xx,
204 and CONNECT 2xx responses get no framing headers. A length of -1 means unknown: chunked on
HTTP/1.1, and for HTTP/1.0 the body ends when the connection closes (Connection: close is
added and the caller must close).
Parameters
- out: *[..] u8
- the buffer the head is appended to.
- status: int
- the status code.
- headers: [] Header_Field
- sent as given. Framing headers are added for you, so passing one is an error.
- body_length: s64
- the body size in bytes, 0 for none, or -1 when it is not known yet.
- options := Response_Options.{}
- version, reason phrase, request method, keep-alive, and the
DateandServervalues.
Returns
- bool