从PHP /阿帕奇返回100继续 [英] Returning 100-Continue from PHP/Apache

查看:142
本文介绍了从PHP /阿帕奇返回100继续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方法,prevent脚本不必要的数据上传到PHP脚本。我原本想杀死传入的连接读这显然是对HTTP协议,我不能让它工作,但我一直在研究替代方案,发现 100继续状态code是正是我需要的。我的客户应发送所需的头部和期待:100 头和服务器应发回任 100继续 417预期失败,但它从我的尝试,使这项工作的100响应被Apache发回PHP有机会做任何处理之前似乎。有没有办法让PHP检查请求头,并发送回一个 100继续响应并继续处理传入的数据? //输入

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 process the incoming data? I'm already read the raw data from php://input.

谢谢,
Ĵ

推荐答案

您不能这样做的纯PHP code(不执行,直到上传完成),但你可以创建一个PHP扩展。也许看看在上传进度其中挂钩到上传过程延伸。

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.

这篇关于从PHP /阿帕奇返回100继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆