Re: HTTP_RAW_POST_DATA
| From: | Zak Greant | Date: | Mon, 07 May 2001 19:02:03 +0000 |
| Subject: | Re: HTTP_RAW_POST_DATA | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51800@lists.php.net to get a copy of this message | ||
Actually, I am afraid that they won't.
To achieve this, break the if/else block up so that both code blocks are
called.
--zak
----- Original Message -----
From: "Dmitri Zasypkin" <dimitri-z@usa.net>
To: <php-general@lists.php.net>
Sent: Monday, May 07, 2001 7:15 AM
Subject: Re: [PHP] HTTP_RAW_POST_DATA
> 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
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>