1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/**
* Get all of the headers from the request.
*
* @param request request to get values from
* @param kind types of values to iterate over, can be a bitmask
* @param iterator callback to call on each header;
* maybe NULL (then just count headers)
* @param iterator_cls extra argument to @a iterator
* @return number of entries iterated over
* @ingroup request
*/
_MHD_EXTERN unsigned int
MHD_request_get_values (struct MHD_Request *request,
enum MHD_ValueKind kind,
MHD_KeyValueIterator iterator,
void *iterator_cls);
/**
* This function can be used to add an entry to the HTTP headers of a
* request (so that the #MHD_request_get_values function will
* return them -- and the `struct MHD_PostProcessor` will also see
* them). This maybe required in certain situations (see Mantis
* #1399) where (broken) HTTP implementations fail to supply values
* needed by the post processor (or other parts of the application).
*
* This function MUST only be called from within the
* request callbacks (otherwise, access maybe improperly
* synchronized). Furthermore, the client must guarantee that the key
* and value arguments are 0-terminated strings that are NOT freed
* until the connection is closed. (The easiest way to do this is by
* passing only arguments to permanently allocated strings.).
*
* @param request the request for which a
* value should be set
* @param kind kind of the value
* @param key key for the value
* @param value the value itself
* @return #MHD_NO if the operation could not be
* performed due to insufficient memory;
* #MHD_YES on success
* @ingroup request
*/
_MHD_EXTERN enum MHD_Bool
MHD_request_set_value (struct MHD_Request *request,
enum MHD_ValueKind kind,
const char *key,
const char *value);
/**
* Get a particular header value. If multiple
* values match the kind, return any one of them.
*
* @param request request to get values from
* @param kind what kind of value are we looking for
* @param key the header to look for, NULL to lookup 'trailing' value without a key
* @return NULL if no such item was found
* @ingroup request
*/
_MHD_EXTERN const char *
MHD_request_lookup_value (struct MHD_Request *request,
enum MHD_ValueKind kind,
const char *key);
|