functions to parse HTTP uploads with MHD More...
Go to the source code of this file.
Enumerations | |
| enum | GNUNET_MHD_PostResult { GNUNET_MHD_PR_SUCCESS , GNUNET_MHD_PR_CONTINUE , GNUNET_MHD_PR_OUT_OF_MEMORY , GNUNET_MHD_PR_REQUEST_TOO_LARGE , GNUNET_MHD_PR_JSON_INVALID } |
| Return codes from GNUNET_MHD_post_parser(). More... | |
Functions | |
| enum GNUNET_MHD_PostResult | GNUNET_MHD_post_parser (size_t buffer_max, struct MHD_Connection *connection, void **con_cls, const char *upload_data, size_t *upload_data_size, json_t **json) |
| Process a POST request containing a JSON object. | |
| void | GNUNET_MHD_post_parser_cleanup (void *con_cls) |
| Function called whenever we are done with a request to clean up our state. | |
functions to parse HTTP uploads with MHD
Definition in file gnunet_mhd_lib.h.
Return codes from GNUNET_MHD_post_parser().
| Enumerator | |
|---|---|
| GNUNET_MHD_PR_SUCCESS | Parsing successful, JSON result is in |
| GNUNET_MHD_PR_CONTINUE | Parsing continues, call again soon! |
| GNUNET_MHD_PR_OUT_OF_MEMORY | Sorry, memory allocation (malloc()) failed. |
| GNUNET_MHD_PR_REQUEST_TOO_LARGE | Request size exceeded |
| GNUNET_MHD_PR_JSON_INVALID | JSON parsing failed. This was not a JSON upload. |
Definition at line 36 of file gnunet_mhd_lib.h.
| enum GNUNET_MHD_PostResult GNUNET_MHD_post_parser | ( | size_t | buffer_max, |
| struct MHD_Connection * | connection, | ||
| void ** | con_cls, | ||
| const char * | upload_data, | ||
| size_t * | upload_data_size, | ||
| json_t ** | json | ||
| ) |
Process a POST request containing a JSON object.
This function realizes an MHD POST processor that will (incrementally) process JSON data uploaded to the HTTP server. It will store the required state in the con_cls, which must be cleaned up using #GNUNET_MHD_post_parser_callback().
| buffer_max | maximum allowed size for the buffer |
| connection | MHD connection handle (for meta data about the upload) |
| con_cls | the closure (will point to a struct Buffer *) |
| upload_data | the POST data |
| upload_data_size | number of bytes in upload_data |
| json | the JSON object for a completed request |
Definition at line 282 of file mhd_upload.c.
References buffer_append(), buffer_deinit(), buffer_init(), Buffer::data, Buffer::fill, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_MHD_PR_CONTINUE, GNUNET_MHD_PR_JSON_INVALID, GNUNET_MHD_PR_OUT_OF_MEMORY, GNUNET_MHD_PR_REQUEST_TOO_LARGE, GNUNET_MHD_PR_SUCCESS, GNUNET_new, GNUNET_OK, inflate_data(), REQUEST_BUFFER_INITIAL, and ret.
| void GNUNET_MHD_post_parser_cleanup | ( | void * | con_cls | ) |
Function called whenever we are done with a request to clean up our state.
| con_cls | value as it was left by GNUNET_MHD_post_parser(), to be cleaned up |
Definition at line 390 of file mhd_upload.c.
References buffer_deinit(), and GNUNET_free.