mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-06 15:51:25 +00:00
Update mg_http_parse_header.md
This commit is contained in:
1 parent
48296bb1cf
commit
bee95654f3
1 file changed
+4
-4
@@ -7,17 +7,17 @@ signature: |
|
|||||||
size_t buf_size);
|
size_t buf_size);
|
||||||
---
|
---
|
||||||
|
|
||||||
Parse HTTP header `hdr`. Find variable `var_name` and store it's value
|
Parses the HTTP header `hdr`. Finds variable `var_name` and stores its value
|
||||||
in the buffer `buf`, `buf_size`. Return 0 if variable not found, non-zero
|
in the buffer `buf`, `buf_size`. Returns 0 if variable not found, non-zero
|
||||||
otherwise.
|
otherwise.
|
||||||
|
|
||||||
This function is supposed to parse
|
This function is supposed to parse
|
||||||
cookies, authentication headers, etcetera. Example (error handling omitted):
|
cookies, authentication headers, etc. Example (error handling omitted):
|
||||||
|
|
||||||
char user[20];
|
char user[20];
|
||||||
struct mg_str *hdr = mg_get_http_header(hm, "Authorization");
|
struct mg_str *hdr = mg_get_http_header(hm, "Authorization");
|
||||||
mg_http_parse_header(hdr, "username", user, sizeof(user));
|
mg_http_parse_header(hdr, "username", user, sizeof(user));
|
||||||
|
|
||||||
Return length of the variable's value. If buffer is not large enough,
|
Returns the length of the variable's value. If buffer is not large enough,
|
||||||
or variable not found, 0 is returned.
|
or variable not found, 0 is returned.
|
||||||
|
|
||||||
Reference in new issue
Block a user