使用curl提交post请求到服务器被squid代理拦截

原文地址:http://dade.io/archives/25/

做网盘,上传文件到服务器时(服务器使用squid做代理),遇到下面的错误提示:

使用curl提交post请求到服务器被squid代理拦截

百思不得其解,查看PHP文档时,笔记中发现如下说明:

Sending a post file upload across a squid proxy, the request was rejected by the proxy. In the error page returned it provided among other possible causes:"Expect:" feature is being asked from a HTTP/one.zero. 
Solution: Add the option <?php curl_setopt($cl,CURLOPT_HTTPHEADER,array("Expect:")); ?>. This will remove the expect http header.

按照方案去掉“Expect:”的header头,OK!

文档还是挺有用的,希望能帮到各位!


你可能感兴趣的:(post,expect,curl,squid)