mongoose/docs/c-api/http_server.h/mg_send_head.md
Sergey Lyubka 12437fd7fe Refactor Mongoose documentation
PUBLISHED_FROM=e9a4e5c7b4a1d03b93a2a79e29de19e60e919929
2016-09-01 14:35:02 +00:00

846 B

title decl_name symbol_kind signature
mg_send_head() mg_send_head func void mg_send_head(struct mg_connection *n, int status_code, int64_t content_length, const char *extra_headers);

Sends the response line and headers. This function sends the response line with the status_code, and automatically sends one header: either "Content-Length" or "Transfer-Encoding". If content_length is negative, then "Transfer-Encoding: chunked" header is sent, otherwise, "Content-Length" header is sent.

NOTE: If Transfer-Encoding is chunked, then message body must be sent using mg_send_http_chunk() or mg_printf_http_chunk() functions. Otherwise, mg_send() or mg_printf() must be used. Extra headers could be set through extra_headers. Note extra_headers must NOT be terminated by a new line.