3
我可以使用curl就好的文件上傳到我的Apache Web服務器:無法測試HTTP通過Squid代理PUT基於文件上傳
echo "[$(date)] file contents." | curl -T - http://WEB-SERVER/upload/sample.put
但是,如果我把一個Squid代理服務器之間,然後我不能給:
echo "[$(date)] file contents." | curl -x http://SQUID-PROXY:3128 -T - http://WEB-SERVER/upload/sample.put
捲曲報告以下錯誤:
注:該故障響應是HTML格式的,但我已經刪除爲了便於閱讀的標籤。
ERROR: The requested URL could not be retrieved
ERROR
The requested URL could not be retrieved
While trying to retrieve the URL:
http://WEB-SERVER/upload/sample.put
The following error was encountered:
Unsupported Request Method and Protocol
Squid does not support all request methods for all access protocols.
For example, you can not POST a Gopher request.
Your cache administrator is root.
我squid.conf
似乎並沒有被任何具有ACL /規則,應該會禁止基於該src
或dst
IP地址,或者,或HTTP method
... 我能做到的HTTP POST
只需在同一個客戶端和Web服務器之間,兩者之間就有相同的代理。
在失敗HTTP PUT
案件情況下,一看就知道實際發生的請求和響應流量,我放在netcat
過程中捲曲和Squid之間,這是我所看到的:
請求:
PUT http://WEB-SERVER/upload/sample.put HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: WEB-SERVER
Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
Expect: 100-continue
響應:
HTTP/1.0 501 Not Implemented
Server: squid/2.6.STABLE21
Date: Sun, 13 May 2012 02:11:39 GMT
Content-Type: text/html
Content-Length: 1078
Expires: Sun, 13 May 2012 02:11:39 GMT
X-Squid-Error: ERR_UNSUP_REQ 0
X-Cache: MISS from SQUID-PROXY-FQDN
X-Cache-Lookup: NONE from SQUID-PROXY-FQDN:3128
Via: 1.0 SQUID-PROXY-FQDN:3128 (squid/2.6.STABLE21)
Proxy-Connection: close
<SNIPPED the HTML error response already shown earlier above>
注意:出於可讀性原因,我始終匿名IP地址和服務器名稱。
我認爲問題是Expect標題。你能刪除它嗎?由於Squid支持PUT方法。 –
我試過了(用'-H「期望:」'選項),但仍然是相同的響應。 – Harry