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.c72
1 files changed, 35 insertions, 37 deletions
diff --git a/src/lib/request.c b/src/lib/request.c
index 02cce55c..5b932bfa 100644
--- a/src/lib/request.c
+++ b/src/lib/request.c
@@ -40,9 +40,9 @@
40 */ 40 */
41unsigned int 41unsigned int
42MHD_request_get_values (struct MHD_Request *request, 42MHD_request_get_values (struct MHD_Request *request,
43 enum MHD_ValueKind kind, 43 enum MHD_ValueKind kind,
44 MHD_KeyValueIterator iterator, 44 MHD_KeyValueIterator iterator,
45 void *iterator_cls) 45 void *iterator_cls)
46{ 46{
47 int ret; 47 int ret;
48 struct MHD_HTTP_Header *pos; 48 struct MHD_HTTP_Header *pos;
@@ -51,18 +51,18 @@ MHD_request_get_values (struct MHD_Request *request,
51 for (pos = request->headers_received; 51 for (pos = request->headers_received;
52 NULL != pos; 52 NULL != pos;
53 pos = pos->next) 53 pos = pos->next)
54 {
55 if (0 != (pos->kind & kind))
54 { 56 {
55 if (0 != (pos->kind & kind)) 57 ret++;
56 { 58 if ( (NULL != iterator) &&
57 ret++; 59 (MHD_YES != iterator (iterator_cls,
58 if ( (NULL != iterator) && 60 pos->kind,
59 (MHD_YES != iterator (iterator_cls, 61 pos->header,
60 pos->kind, 62 pos->value)) )
61 pos->header, 63 return ret;
62 pos->value)) )
63 return ret;
64 }
65 } 64 }
65 }
66 return ret; 66 return ret;
67} 67}
68 68
@@ -94,9 +94,9 @@ MHD_request_get_values (struct MHD_Request *request,
94 */ 94 */
95enum MHD_Bool 95enum MHD_Bool
96MHD_request_set_value (struct MHD_Request *request, 96MHD_request_set_value (struct MHD_Request *request,
97 enum MHD_ValueKind kind, 97 enum MHD_ValueKind kind,
98 const char *key, 98 const char *key,
99 const char *value) 99 const char *value)
100{ 100{
101 struct MHD_HTTP_Header *pos; 101 struct MHD_HTTP_Header *pos;
102 102
@@ -111,15 +111,15 @@ MHD_request_set_value (struct MHD_Request *request,
111 pos->next = NULL; 111 pos->next = NULL;
112 /* append 'pos' to the linked list of headers */ 112 /* append 'pos' to the linked list of headers */
113 if (NULL == request->headers_received_tail) 113 if (NULL == request->headers_received_tail)
114 { 114 {
115 request->headers_received = pos; 115 request->headers_received = pos;
116 request->headers_received_tail = pos; 116 request->headers_received_tail = pos;
117 } 117 }
118 else 118 else
119 { 119 {
120 request->headers_received_tail->next = pos; 120 request->headers_received_tail->next = pos;
121 request->headers_received_tail = pos; 121 request->headers_received_tail = pos;
122 } 122 }
123 return MHD_YES; 123 return MHD_YES;
124} 124}
125 125
@@ -136,27 +136,25 @@ MHD_request_set_value (struct MHD_Request *request,
136 */ 136 */
137const char * 137const char *
138MHD_request_lookup_value (struct MHD_Request *request, 138MHD_request_lookup_value (struct MHD_Request *request,
139 enum MHD_ValueKind kind, 139 enum MHD_ValueKind kind,
140 const char *key) 140 const char *key)
141{ 141{
142 struct MHD_HTTP_Header *pos; 142 struct MHD_HTTP_Header *pos;
143 143
144 for (pos = request->headers_received; 144 for (pos = request->headers_received;
145 NULL != pos; 145 NULL != pos;
146 pos = pos->next) 146 pos = pos->next)
147 { 147 {
148 if ((0 != (pos->kind & kind)) && 148 if ((0 != (pos->kind & kind)) &&
149 ( (key == pos->header) || 149 ( (key == pos->header) ||
150 ( (NULL != pos->header) && 150 ( (NULL != pos->header) &&
151 (NULL != key) && 151 (NULL != key) &&
152 (MHD_str_equal_caseless_(key, 152 (MHD_str_equal_caseless_ (key,
153 pos->header))))) 153 pos->header)))))
154 return pos->value; 154 return pos->value;
155 } 155 }
156 return NULL; 156 return NULL;
157} 157}
158 158
159 159
160/* end of request.c */ 160/* end of request.c */
161
162