diff options
Diffstat (limited to 'src/microhttpd/response.c')
-rw-r--r-- | src/microhttpd/response.c | 66 |
1 files changed, 44 insertions, 22 deletions
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 5db03824..f6db5326 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c | |||
@@ -83,7 +83,8 @@ add_response_entry (struct MHD_Response *response, | |||
83 | * @param response response to add a header to | 83 | * @param response response to add a header to |
84 | * @param header the header to add | 84 | * @param header the header to add |
85 | * @param content value to add | 85 | * @param content value to add |
86 | * @return MHD_NO on error (i.e. invalid header or content format). | 86 | * @return #MHD_NO on error (i.e. invalid header or content format). |
87 | * @ingroup response | ||
87 | */ | 88 | */ |
88 | int | 89 | int |
89 | MHD_add_response_header (struct MHD_Response *response, | 90 | MHD_add_response_header (struct MHD_Response *response, |
@@ -102,7 +103,8 @@ MHD_add_response_header (struct MHD_Response *response, | |||
102 | * @param response response to remove a header from | 103 | * @param response response to remove a header from |
103 | * @param footer the footer to delete | 104 | * @param footer the footer to delete |
104 | * @param content value to delete | 105 | * @param content value to delete |
105 | * @return MHD_NO on error (i.e. invalid footer or content format). | 106 | * @return #MHD_NO on error (i.e. invalid footer or content format). |
107 | * @ingroup response | ||
106 | */ | 108 | */ |
107 | int | 109 | int |
108 | MHD_add_response_footer (struct MHD_Response *response, | 110 | MHD_add_response_footer (struct MHD_Response *response, |
@@ -116,16 +118,18 @@ MHD_add_response_footer (struct MHD_Response *response, | |||
116 | 118 | ||
117 | 119 | ||
118 | /** | 120 | /** |
119 | * Delete a header line from the response. | 121 | * Delete a header (or footer) line from the response. |
120 | * | 122 | * |
121 | * @param response response to remove a header from | 123 | * @param response response to remove a header from |
122 | * @param header the header to delete | 124 | * @param header the header to delete |
123 | * @param content value to delete | 125 | * @param content value to delete |
124 | * @return MHD_NO on error (no such header known) | 126 | * @return #MHD_NO on error (no such header known) |
127 | * @ingroup response | ||
125 | */ | 128 | */ |
126 | int | 129 | int |
127 | MHD_del_response_header (struct MHD_Response *response, | 130 | MHD_del_response_header (struct MHD_Response *response, |
128 | const char *header, const char *content) | 131 | const char *header, |
132 | const char *content) | ||
129 | { | 133 | { |
130 | struct MHD_HTTP_Header *pos; | 134 | struct MHD_HTTP_Header *pos; |
131 | struct MHD_HTTP_Header *prev; | 135 | struct MHD_HTTP_Header *prev; |
@@ -156,13 +160,14 @@ MHD_del_response_header (struct MHD_Response *response, | |||
156 | 160 | ||
157 | 161 | ||
158 | /** | 162 | /** |
159 | * Get all of the headers added to a response. | 163 | * Get all of the headers (and footers) added to a response. |
160 | * | 164 | * |
161 | * @param response response to query | 165 | * @param response response to query |
162 | * @param iterator callback to call on each header; | 166 | * @param iterator callback to call on each header; |
163 | * maybe NULL (then just count headers) | 167 | * maybe NULL (then just count headers) |
164 | * @param iterator_cls extra argument to iterator | 168 | * @param iterator_cls extra argument to @a iterator |
165 | * @return number of entries iterated over | 169 | * @return number of entries iterated over |
170 | * @ingroup response | ||
166 | */ | 171 | */ |
167 | int | 172 | int |
168 | MHD_get_response_headers (struct MHD_Response *response, | 173 | MHD_get_response_headers (struct MHD_Response *response, |
@@ -184,11 +189,12 @@ MHD_get_response_headers (struct MHD_Response *response, | |||
184 | 189 | ||
185 | 190 | ||
186 | /** | 191 | /** |
187 | * Get a particular header from the response. | 192 | * Get a particular header (or footer) from the response. |
188 | * | 193 | * |
189 | * @param response response to query | 194 | * @param response response to query |
190 | * @param key which header to get | 195 | * @param key which header to get |
191 | * @return NULL if header does not exist | 196 | * @return NULL if header does not exist |
197 | * @ingroup response | ||
192 | */ | 198 | */ |
193 | const char * | 199 | const char * |
194 | MHD_get_response_header (struct MHD_Response *response, | 200 | MHD_get_response_header (struct MHD_Response *response, |
@@ -209,16 +215,17 @@ MHD_get_response_header (struct MHD_Response *response, | |||
209 | * Create a response object. The response object can be extended with | 215 | * Create a response object. The response object can be extended with |
210 | * header information and then be used any number of times. | 216 | * header information and then be used any number of times. |
211 | * | 217 | * |
212 | * @param size size of the data portion of the response, MHD_SIZE_UNKNOWN for unknown | 218 | * @param size size of the data portion of the response, #MHD_SIZE_UNKNOWN for unknown |
213 | * @param block_size preferred block size for querying crc (advisory only, | 219 | * @param block_size preferred block size for querying crc (advisory only, |
214 | * MHD may still call crc using smaller chunks); this | 220 | * MHD may still call @a crc using smaller chunks); this |
215 | * is essentially the buffer size used for IO, clients | 221 | * is essentially the buffer size used for IO, clients |
216 | * should pick a value that is appropriate for IO and | 222 | * should pick a value that is appropriate for IO and |
217 | * memory performance requirements | 223 | * memory performance requirements |
218 | * @param crc callback to use to obtain response data | 224 | * @param crc callback to use to obtain response data |
219 | * @param crc_cls extra argument to crc | 225 | * @param crc_cls extra argument to @a crc |
220 | * @param crfc callback to call to free crc_cls resources | 226 | * @param crfc callback to call to free @a crc_cls resources |
221 | * @return NULL on error (i.e. invalid arguments, out of memory) | 227 | * @return NULL on error (i.e. invalid arguments, out of memory) |
228 | * @ingroup response | ||
222 | */ | 229 | */ |
223 | struct MHD_Response * | 230 | struct MHD_Response * |
224 | MHD_create_response_from_callback (uint64_t size, | 231 | MHD_create_response_from_callback (uint64_t size, |
@@ -298,13 +305,21 @@ free_callback (void *cls) | |||
298 | * header information and then be used any number of times. | 305 | * header information and then be used any number of times. |
299 | * | 306 | * |
300 | * @param size size of the data portion of the response | 307 | * @param size size of the data portion of the response |
301 | * @param fd file descriptor referring to a file on disk with the data | 308 | * @param fd file descriptor referring to a file on disk with the |
302 | * @param offset offset to start reading from in the file | 309 | * data; will be closed when response is destroyed; |
310 | * fd should be in 'blocking' mode | ||
311 | * @param offset offset to start reading from in the file; | ||
312 | * Be careful! `off_t` may have been compiled to be a | ||
313 | * 64-bit variable for MHD, in which case your application | ||
314 | * also has to be compiled using the same options! Read | ||
315 | * the MHD manual for more details. | ||
303 | * @return NULL on error (i.e. invalid arguments, out of memory) | 316 | * @return NULL on error (i.e. invalid arguments, out of memory) |
317 | * @ingroup response | ||
304 | */ | 318 | */ |
305 | struct MHD_Response *MHD_create_response_from_fd_at_offset (size_t size, | 319 | struct MHD_Response * |
306 | int fd, | 320 | MHD_create_response_from_fd_at_offset (size_t size, |
307 | off_t offset) | 321 | int fd, |
322 | off_t offset) | ||
308 | { | 323 | { |
309 | struct MHD_Response *response; | 324 | struct MHD_Response *response; |
310 | 325 | ||
@@ -329,9 +344,11 @@ struct MHD_Response *MHD_create_response_from_fd_at_offset (size_t size, | |||
329 | * @param size size of the data portion of the response | 344 | * @param size size of the data portion of the response |
330 | * @param fd file descriptor referring to a file on disk with the data | 345 | * @param fd file descriptor referring to a file on disk with the data |
331 | * @return NULL on error (i.e. invalid arguments, out of memory) | 346 | * @return NULL on error (i.e. invalid arguments, out of memory) |
347 | * @ingroup response | ||
332 | */ | 348 | */ |
333 | struct MHD_Response *MHD_create_response_from_fd (size_t size, | 349 | struct MHD_Response * |
334 | int fd) | 350 | MHD_create_response_from_fd (size_t size, |
351 | int fd) | ||
335 | { | 352 | { |
336 | return MHD_create_response_from_fd_at_offset (size, fd, 0); | 353 | return MHD_create_response_from_fd_at_offset (size, fd, 0); |
337 | } | 354 | } |
@@ -341,14 +358,15 @@ struct MHD_Response *MHD_create_response_from_fd (size_t size, | |||
341 | * Create a response object. The response object can be extended with | 358 | * Create a response object. The response object can be extended with |
342 | * header information and then be used any number of times. | 359 | * header information and then be used any number of times. |
343 | * | 360 | * |
344 | * @param size size of the data portion of the response | 361 | * @param size size of the @a data portion of the response |
345 | * @param data the data itself | 362 | * @param data the data itself |
346 | * @param must_free libmicrohttpd should free data when done | 363 | * @param must_free libmicrohttpd should free data when done |
347 | * @param must_copy libmicrohttpd must make a copy of data | 364 | * @param must_copy libmicrohttpd must make a copy of @a data |
348 | * right away, the data maybe released anytime after | 365 | * right away, the data maybe released anytime after |
349 | * this call returns | 366 | * this call returns |
350 | * @return NULL on error (i.e. invalid arguments, out of memory) | 367 | * @return NULL on error (i.e. invalid arguments, out of memory) |
351 | * @deprecated use MHD_create_response_from_buffer instead | 368 | * @deprecated use #MHD_create_response_from_buffer instead |
369 | * @ingroup response | ||
352 | */ | 370 | */ |
353 | struct MHD_Response * | 371 | struct MHD_Response * |
354 | MHD_create_response_from_data (size_t size, | 372 | MHD_create_response_from_data (size_t size, |
@@ -399,6 +417,7 @@ MHD_create_response_from_data (size_t size, | |||
399 | * @param buffer size bytes containing the response's data portion | 417 | * @param buffer size bytes containing the response's data portion |
400 | * @param mode flags for buffer management | 418 | * @param mode flags for buffer management |
401 | * @return NULL on error (i.e. invalid arguments, out of memory) | 419 | * @return NULL on error (i.e. invalid arguments, out of memory) |
420 | * @ingroup response | ||
402 | */ | 421 | */ |
403 | struct MHD_Response * | 422 | struct MHD_Response * |
404 | MHD_create_response_from_buffer (size_t size, | 423 | MHD_create_response_from_buffer (size_t size, |
@@ -417,6 +436,9 @@ MHD_create_response_from_buffer (size_t size, | |||
417 | * libmicrohttpd may keep some of the resources around if the response | 436 | * libmicrohttpd may keep some of the resources around if the response |
418 | * is still in the queue for some clients, so the memory may not | 437 | * is still in the queue for some clients, so the memory may not |
419 | * necessarily be freed immediatley. | 438 | * necessarily be freed immediatley. |
439 | * | ||
440 | * @param response response to destroy | ||
441 | * @ingroup response | ||
420 | */ | 442 | */ |
421 | void | 443 | void |
422 | MHD_destroy_response (struct MHD_Response *response) | 444 | MHD_destroy_response (struct MHD_Response *response) |