GNU libmicrohttpd 1.0.0
|
Methods for parsing POST data. More...
#include "postprocessor.h"
#include "internal.h"
#include "mhd_str.h"
#include "mhd_compat.h"
#include "mhd_assert.h"
Go to the source code of this file.
Macros | |
#define | XBUF_SIZE 512 |
Methods for parsing POST data.
Definition in file postprocessor.c.
#define XBUF_SIZE 512 |
Size of on-stack buffer that we use for un-escaping of the value. We use a pretty small value to be nice to the stack on embedded systems.
Definition at line 39 of file postprocessor.c.
Referenced by process_value().
|
static |
pp | post processor context |
boundary | boundary to look for |
blen | number of bytes in boundary |
ioffptr | set to the end of the boundary if found, otherwise incremented by one (FIXME: quirky API!) |
next_state | state to which we should advance the post processor if the boundary is found |
next_dash_state | dash_state to which we should advance the post processor if the boundary is found |
Definition at line 626 of file postprocessor.c.
References MHD_PostProcessor::blen, MHD_PostProcessor::boundary, MHD_HTTP_OK, MHD_NO, MHD_YES, NULL, PP_Error, PP_Init, and RN_Dash.
Referenced by post_process_multipart().
|
static |
pp | post processor context |
Definition at line 919 of file postprocessor.c.
References MHD_HTTP_OK, NE_content_filename, NE_content_name, NE_content_transfer_encoding, NE_content_type, and NULL.
Referenced by MHD_destroy_post_processor(), and post_process_multipart().
|
static |
Decode multipart POST data.
pp | post processor context |
post_data | data to decode |
post_data_len | number of bytes in post_data |
Per RFC2046 5.1.1 NOTE TO IMPLEMENTORS, consume anything prior to the first multipart boundary:
There appears to be room for additional information prior to the first boundary delimiter line and following the final boundary delimiter line. These areas should generally be left blank, and implementations must ignore anything that appears before the first boundary delimiter line or after the last one.
Definition at line 957 of file postprocessor.c.
References _, find_boundary(), free_unmarked(), MHD_HTTP_OK, MHD_NO, MHD_PANIC, MHD_STATICSTR_LEN_, MHD_str_equal_caseless_n_(), MHD_YES, NE_content_filename, NE_content_name, NE_content_transfer_encoding, NE_content_type, NE_none, NULL, PP_Callback, PP_Done, PP_Error, PP_Init, PP_Nested_Init, PP_Nested_PerformCleanup, PP_Nested_PerformMarking, PP_Nested_ProcessEntryHeaders, PP_Nested_ProcessValueToBoundary, PP_NextBoundary, PP_PerformCheckMultipart, PP_PerformCleanup, PP_ProcessEntryHeaders, PP_ProcessKey, PP_ProcessValue, PP_ProcessValueToBoundary, process_multipart_headers(), process_value_to_boundary(), RN_Dash, RN_Dash2, RN_Full, RN_Inactive, and RN_OptN.
Referenced by MHD_post_process().
|
static |
Process url-encoded POST data.
pp | post processor context |
post_data | upload data |
post_data_len | number of bytes in post_data |
Definition at line 279 of file postprocessor.c.
References _, MHD_PostProcessor::buffer_pos, mhd_assert, MHD_HTTP_OK, MHD_http_unescape(), MHD_NO, MHD_PANIC, MHD_unescape_plus(), MHD_YES, NULL, PP_Callback, PP_Done, PP_Error, PP_Init, PP_Nested_Init, PP_Nested_PerformCleanup, PP_Nested_PerformMarking, PP_Nested_ProcessEntryHeaders, PP_Nested_ProcessValueToBoundary, PP_NextBoundary, PP_PerformCheckMultipart, PP_PerformCleanup, PP_ProcessEntryHeaders, PP_ProcessKey, PP_ProcessValue, PP_ProcessValueToBoundary, and process_value().
Referenced by MHD_destroy_post_processor(), and MHD_post_process().
|
static |
Go over the headers of the part and update the fields in "pp" according to what we find. If we are at the end of the headers (as indicated by an empty line), transition into next_state.
pp | post processor context |
ioffptr | set to how many bytes have been processed |
next_state | state to which the post processor should be advanced if we find the end of the headers |
Definition at line 745 of file postprocessor.c.
References MHD_PostProcessor::buffer_pos, MHD_HTTP_OK, MHD_NO, MHD_STATICSTR_LEN_, MHD_str_equal_caseless_n_(), MHD_YES, PP_Error, RN_Full, RN_OptN, try_get_value(), and try_match_header().
Referenced by post_process_multipart().
|
static |
Give a (possibly partial) value to the application callback. We have some part of the value in the 'pp->xbuf', the rest is between value_start and value_end. If last_escape is non-NULL, there may be an incomplete escape sequence at at value_escape between value_start and value_end which we should preserve in 'pp->xbuf' for the future.
Unescapes the value and calls the iterator together with the key. The key must already be in the key buffer allocated and 0-terminated at the end of pp at the time of the call.
[in,out] | pp | post processor to act upon |
value_start | where in memory is the value | |
value_end | where does the value end | |
last_escape | last ''-sign in value range, if relevant, or NULL |
Definition at line 137 of file postprocessor.c.
References mhd_assert, MHD_HTTP_OK, MHD_http_unescape(), MHD_NO, MHD_POSTDATA_KIND, MHD_unescape_plus(), NULL, PP_Error, MHD_PostProcessor::xbuf, and XBUF_SIZE.
Referenced by post_process_urlencoded().
|
static |
We have the value until we hit the given boundary; process accordingly.
pp | post processor context |
ioffptr | incremented based on the number of bytes processed |
boundary | the boundary to look for |
blen | strlen(boundary) |
next_state | what state to go into after the boundary was found |
next_dash_state | state to go into if the next boundary ends with "--" |
Definition at line 819 of file postprocessor.c.
References MHD_PostProcessor::blen, MHD_PostProcessor::boundary, MHD_HTTP_OK, MHD_NO, MHD_POSTDATA_KIND, MHD_YES, NULL, PP_Error, and RN_Dash.
Referenced by post_process_multipart().
In buf, there maybe an expression '$key="$value"'. If that is the case, copy a copy of $value to destination.
If destination is already non-NULL, do nothing.
Definition at line 687 of file postprocessor.c.
References MHD_HTTP_OK, and NULL.
Referenced by process_multipart_headers().
|
static |
If the given line matches the prefix, strdup the rest of the line into the suffix ptr.
prefix | prefix to match |
prefix_len | length of prefix |
line | line to match prefix in |
suffix | set to a copy of the rest of the line, starting at the end of the match |
Definition at line 590 of file postprocessor.c.
References MHD_HTTP_OK, MHD_NO, MHD_str_equal_caseless_n_(), MHD_YES, and NULL.
Referenced by process_multipart_headers().