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