Re: HTTP_RAW_POST_DATA
| From: | Zak Greant | Date: | Mon, 07 May 2001 12:52:33 +0000 |
| Subject: | Re: HTTP_RAW_POST_DATA | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51721@lists.php.net to get a copy of this message | ||
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