Civetweb API Reference

struct mg_request_info;


request_methodconst char *The request method used by the client for the connection this can be GET, POST or one of the other common HTTP request methods
request_uriconst char *The absolute, relative or URL-encoded URI as it was sent in the request. Example: “” or “/path/to/file.ext”, depending on the client.
local_uriconst char *The relative URL-encoded URI as it references the local resource. If the request URI does not reference a resource on the local server, this field is NULL. Example: “/path/to/file.ext” (even if the client used “” in the request)
uriconst char *Deprecated. Use local_uri instead
http_versionconst char *The HTTP version as mentioned in the client request. This can be “1.0”, “1.1”, etc.
query_stringconst char *The HTTP query string, defined as URL part after the first ‘?’ character, not including ‘?’. NULL if there is no ‘?’.
remote_userconst char *The name of the authenticated remote user, or NULL if no authentication was used. Only used for HTTP (digest) authentication, not for cookie based authentication.
remote addrchar[48]The IP address of the remote client as a string. This can either represent an IPv4 or an IPv6 address. Example: “”
remote_iplongDeprecated. Use remote_addr instead
content_lengthlong longThe content length of the request body. This value can be -1 if no content length was provided. The request may still have body data, but the server cannot determine the length until all data has arrived (e.g. when the client closes the connection, or the final chunk of a chunked request has been received).
remote_portintThe port number at the client's side (an integer number between 1 and 65535).
is_sslint1 if the connection is over SSL (https), and 0 if it is a plain connection (http)
user_datavoid *A pointer to the user_data information which was provided as a parameter to mg_start().
conn_datavoid *A pointer to connection specific user data
num_headersintThe number of HTTP request headers sent by the client (see http_headers)
http_headersstruct mg_header[64]Array of structures with the HTTP request headers sent by the client. For the number of filled header fields, ee num_headers.
client_certstruct mg_client_cert *Pointer to the client certificate information, when available. This field is only filled for https connections using client certificates.


The mg_request_info structure contains the client information of an existing connection.

See Also