Re: retrieve POST body?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Regarding some discussion a while back about putting in a feature request for obtaining the POST body...

I can see the advantage of streaming the POST body directly to disk, because then you don't have to allocate a huge amount of memory for keeping a copy of the POST body in a variable. So maybe (and this is wishful thinking), a feature could be added to PHP where the entire POST body, unaltered, is streamed to a file in the same fasion as those individual temporary files referenced in the $_FILES[] array.

Then for HTTP digest authenticated requests with integrity protection, I could just call md5_file() on this special file, and my world would be a whole lot simpler! (And any other script programmers, should they need to access the POST body for whatever reason, can just read the file and parse it however necessary. No gigantic memory overhead involved.)

Just a thought.



Gregory Beaver wrote:
Good news and bad news.  Rasmus reports on IRC:

[21:57] <Rasmus_> We never buffer the data in file upload mode
[21:57] <Rasmus_> it is streamed to disk, so no, you can't get it all in
a variable like that
[21:57] <Rasmus_> set a different content-type if you want to do that
[21:57] <Rasmus_> assuming you have control over the client
[21:58] <CelloG> can you do a file upload without multipart?
[21:59] <Rasmus_> Well, if you want to pick a POST apart yourself, sure
[21:59] <Rasmus_> set a mime type PHP doesn't understand and it will be
in http_raw_post_data and then you can do whatever you want with it

So the answer is "sort of."  You would have to parse the POST data
yourself, but it is technically a possibility.

Regards,
Greg
--
Experience the revolution, buy the PEAR Installer Manifesto
http://www.packtpub.com/book/PEAR-installer


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux