projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
add userhandler test
[m6w6/ext-http]
/
src
/
php_http_params.c
diff --git
a/src/php_http_params.c
b/src/php_http_params.c
index 8db5c353bd18c004ecc8bef617431577fafcb526..8988f43c65c0cd33dcd9ff7220304c0c4065d7bd 100644
(file)
--- a/
src/php_http_params.c
+++ b/
src/php_http_params.c
@@
-248,16
+248,18
@@
static inline void sanitize_key(unsigned flags, const char *str, size_t len, zva
if (flags & PHP_HTTP_PARAMS_ESCAPED) {
sanitize_escaped(zv);
}
if (flags & PHP_HTTP_PARAMS_ESCAPED) {
sanitize_escaped(zv);
}
-
+
if (!Z_STRLEN_P(zv)) {
return;
}
if (!Z_STRLEN_P(zv)) {
return;
}
- eos = &Z_STRVAL_P(zv)[Z_STRLEN_P(zv)-1];
- if (*eos == '*') {
- *eos = '\0';
- *rfc5987 = 1;
- Z_STRLEN_P(zv) -= 1;
+ if (flags & PHP_HTTP_PARAMS_RFC5987) {
+ eos = &Z_STRVAL_P(zv)[Z_STRLEN_P(zv)-1];
+ if (*eos == '*') {
+ *eos = '\0';
+ *rfc5987 = 1;
+ Z_STRLEN_P(zv) -= 1;
+ }
}
if (flags & PHP_HTTP_PARAMS_URLENCODED) {
}
if (flags & PHP_HTTP_PARAMS_URLENCODED) {
@@
-552,8
+554,12
@@
static void merge_param(HashTable *params, zval *zdata, zval **current_param, zv
static void push_param(HashTable *params, php_http_params_state_t *state, const php_http_params_opts_t *opts)
{
if (state->val.str) {
static void push_param(HashTable *params, php_http_params_state_t *state, const php_http_params_opts_t *opts)
{
if (state->val.str) {
- if (0 < (state->val.len = state->input.str - state->val.str)) {
+ if (!state->current.val) {
+ return;
+ } else if (0 < (state->val.len = state->input.str - state->val.str)) {
sanitize_value(opts->flags, state->val.str, state->val.len, state->current.val, state->rfc5987);
sanitize_value(opts->flags, state->val.str, state->val.len, state->current.val, state->rfc5987);
+ } else {
+ ZVAL_EMPTY_STRING(state->current.val);
}
state->rfc5987 = 0;
} else if (state->arg.str) {
}
state->rfc5987 = 0;
} else if (state->arg.str) {
@@
-635,7
+641,7
@@
static size_t check_sep(php_http_params_state_t *state, php_http_params_token_t
if (state->quotes || state->escape) {
return 0;
}
if (state->quotes || state->escape) {
return 0;
}
-
+
if (sep) while (*sep) {
if (check_str(state->input.str, state->input.len, (*sep)->str, (*sep)->len)) {
return (*sep)->len;
if (sep) while (*sep) {
if (check_str(state->input.str, state->input.len, (*sep)->str, (*sep)->len)) {
return (*sep)->len;
@@
-685,7
+691,7
@@
HashTable *php_http_params_parse(HashTable *params, const php_http_params_opts_t
} else {
state.escape = (*state.input.str == '\\');
}
} else {
state.escape = (*state.input.str == '\\');
}
-
+
if (!state.param.str) {
/* initialize */
skip_sep(0, &state, opts->param, opts->arg, opts->val);
if (!state.param.str) {
/* initialize */
skip_sep(0, &state, opts->param, opts->arg, opts->val);
@@
-739,7
+745,7
@@
HashTable *php_http_params_parse(HashTable *params, const php_http_params_opts_t
}
}
}
}
}
}
-
+
if (state.input.len) {
++state.input.str;
--state.input.len;
if (state.input.len) {
++state.input.str;
--state.input.len;