开发者

Returning 100-Continue from PHP/Apache

I'm trying to find a way to prevent a script uploading unnecessary data to a PHP script. I had originally tried to kill the incoming read connection which is obviously against the HTTP protocol and I couldn't make it work but I have been researching alternatives and found that the 100-Continue status code is exactly what I need. My client should send the required headers and Expect: 100 header and the server should send back either 100 Continue or 417 Expectation failed but it seems from my attempts to make this work that the 100 response is sent back by Apache before PHP has a chance to do any processing. Is there a way to have PHP examine the request headers and send back a 100 Continue response and continue to proce开发者_运维问答ss the incoming data? I'm already read the raw data from php://input.

Thanks, J


You cannot do it in pure PHP code (which isn't executed until the upload is complete), but you can create a PHP extension. Maybe take a look at the uploadprogress extension which hooks into the upload process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜