Re: HTTP_RAW_POST_DATA

From: Date: Mon, 07 May 2001 13:15:35 +0000
Subject: Re: HTTP_RAW_POST_DATA
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-51731@lists.php.net to get a copy of this message
Zak, Thank you for the answer. Are you sure $HTTP_POST_VARS will be still set after that modification in case of a valid x-www-form-urlencoded POST request? I'm afraid they won't.. Such side effect is very undesirable for me. Anyway thanks. Zak Greant wrote: > Dmitri Zasypkin wrote: > > Hi, > > > > Could anyone help me with altering PHP sources? Or tell me please where > > may I ask this question? > > > > The problem is when PHP handles a POST request of a known Content-type > > (e.g. x-www-form-urlencoded), it leaves $HTTP_RAW_POST_DATA blank. I > > need to alter the sources so that PHP would always put the request data > > into this variable. > > > > This would allow me to handle malformed POST requests. For example, if a > > client sends a request of Content-type x-www-form-urlencoded and the > > data is NOT really "urlencoded", such request seems to get lost. I can't > > find the data neither in $HTTP_RAW_POST_DATA, nor in $HTTP_POST_VARS. I > > figured it would be great if PHP could always set $HTTP_RAW_POST_DATA > > independently of the Content-type. > > **WILD GUESS ALERT** > > If you modify lines 140-150 of php4/main/SAPI.c from: > > -------------------------------------------------- > > if (zend_hash_find(&known_post_content_types, content_type, > content_type_length+1, (void **) &post_entry)==SUCCESS) { > SG(request_info).post_entry = post_entry; > post_reader_func = post_entry->post_reader; > } else { > if (!sapi_module.default_post_reader) { > sapi_module.sapi_error(E_WARNING, "Unsupported content type: > '%s'", content_type); > return; > } > SG(request_info).post_entry = NULL; > post_reader_func = sapi_module.default_post_reader; > } > > -------------------------------------------------- > > to: > > -------------------------------------------------- > > SG(request_info).post_entry = NULL; > post_reader_func = sapi_module.default_post_reader; > > -------------------------------------------------- > > you *may* get the behavior that you are looking for. > > --zak >

« previous php.general (#51731) next »