I can upload a file to my Apache web server using Curl just fine:
echo "[$(date)] file contents." | curl -T - http://WEB-SERVER/upload/sample.put
However, if I put a Squid proxy server in between, then I am not able to:
echo "[$(date)] file contents." | curl -x http://SQUID-PROXY:3128 -T - http://WEB-SERVER/upload/sample.put
Curl reports the following error:
Note: This error response was in HTML format, but I've removed the tags for ease of reading.
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 doesn't seem to be having any ACL/rule that should disallow based on the
dst IP addresses, or the
protocol, or the HTTP
method... as I can do an
HTTP POST just fine between the same client and the web server, with the same proxy sitting in between.
In case of the failing
HTTP PUT case, to see the request and response traffic that was actually occurring, I placed a
netcat process in between Curl and Squid, and this is what I saw:
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>
Note: I have anonymized the IP addresses and server names throughout for readability reasons.
Note: I had posted this question on StackOverflow also, but got no helpful response. Posting it here, in case people on StackOverflow are seeing this as a non-programming question and not taking interest.