]> git.proxmox.com Git - ceph.git/blame - ceph/src/civetweb/docs/api/mg_get_cookie.md
buildsys: switch source download to quincy
[ceph.git] / ceph / src / civetweb / docs / api / mg_get_cookie.md
CommitLineData
11fdf7f2
TL
1# Civetweb API Reference
2
3### `mg_get_cookie( cookie, var_name, buf, buf_len );`
4
5### Parameters
6
7| Parameter | Type | Description |
8| :--- | :--- | :--- |
9|**`cookie`**|`const char *`|The cookie name|
10|**`var_name`**|`const char *`|The variable name|
11|**`buf`**|`char *`|The buffer where to store the contents of the cookie|
12|**`buf_len`**|`size_t`|The length of the cookie buffer, including the terminating NUL|
13
14### Return Value
15
16| Type | Description |
17| :--- | :--- |
18|`int`|The length of the cookie or an error code|
19
20### Description
21
22The function `mg_get_cookie()` tries to fetch the value of a certain cookie variable. The contents will either be stored in an application provided buffer, or an error code will be returned. The destination buffer is guaranteed to be NUL terminated if the pointer of the buffer is not a NULL pointer and the size of the buffer is at least one byte.
23
24If the function succeeds, the return value of the function is the length in bytes of the cookie. The value **`-1`** is returned if the requested cookie could not be found and **`-2`** if the destination buffer is represented by a NULL pointer, is zero length or too short to store the whole cookie.
25
26### See Also
27
28* [`mg_get_var();`](mg_get_var.md)
29* [`mg_get_var2();`](mg_get_var2.md)