diff options
author | Zeev Suraski <zeev@php.net> | 2000-02-17 20:23:59 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2000-02-17 20:23:59 +0000 |
commit | a6393de6f7211ec72c1cdffbc30078fe35ce87c3 (patch) | |
tree | c065f101d37a1b091657cd7f7f3418126e51f1a6 /main/rfc1867.c | |
parent | 8805f09d87b09e43cef2b33be93dfb004c4a18b1 (diff) | |
download | php-git-a6393de6f7211ec72c1cdffbc30078fe35ce87c3.tar.gz |
Make POST handling the way it should be. RFC1867, and any future POST handlers we might
have in the future now obey to the variables_order directive, and there's a real way modular
way to handle POST content.
This is all untested, BEFORE_SAPI_POST_PATCH_17_FEB_2000 tagged before submission
@- Made multipart/form-data content obey to the variables_order directive (Zeev)
Diffstat (limited to 'main/rfc1867.c')
-rw-r--r-- | main/rfc1867.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c index ef01e1e3f8..a4d041f457 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -33,7 +33,7 @@ /* * Split raw mime stream up into appropriate components */ -static void php_mime_split(char *buf, int cnt, char *boundary) +static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr) { char *ptr, *loc, *loc2, *s, *name, *filename, *u, *fn; int len, state = 0, Done = 0, rem, urem; @@ -42,18 +42,9 @@ static void php_mime_split(char *buf, int cnt, char *boundary) char *namebuf=NULL, *filenamebuf=NULL, *lbuf=NULL; FILE *fp; int itype; - zval *http_post_vars=NULL; ELS_FETCH(); PLS_FETCH(); - if (PG(track_vars)) { - ALLOC_ZVAL(http_post_vars); - array_init(http_post_vars); - INIT_PZVAL(http_post_vars); - - zend_hash_add(&EG(symbol_table), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), &http_post_vars, sizeof(pval *), NULL); - } - ptr = buf; rem = cnt; len = strlen(boundary); @@ -164,7 +155,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary) *(loc - 4) = '\0'; /* Magic function that figures everything out */ - php_register_variable(namebuf, ptr, http_post_vars ELS_CC PLS_CC); + php_register_variable(namebuf, ptr, array_ptr ELS_CC PLS_CC); /* And a little kludge to pick out special MAX_FILE_SIZE */ itype = php_check_ident_type(namebuf); @@ -243,10 +234,11 @@ static void php_mime_split(char *buf, int cnt, char *boundary) } -SAPI_POST_READER_FUNC(rfc1867_post_reader) +SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) { char *boundary; uint boundary_len; + zval *array_ptr = (zval *) arg; boundary = strstr(content_type_dup, "boundary"); if (!boundary || !(boundary=strchr(boundary, '='))) { @@ -256,11 +248,8 @@ SAPI_POST_READER_FUNC(rfc1867_post_reader) boundary++; boundary_len = strlen(boundary); - sapi_read_standard_form_data(content_type_dup SLS_CC); if (SG(request_info).post_data) { - php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary); - efree(SG(request_info).post_data); - SG(request_info).post_data = NULL; + php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary, array_ptr); } } |