Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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. 

My squid.conf doesn't seem to be having any ACL/rule that should disallow based on the src or 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:

Request:

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

Response:

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Thanks to Amos Jeffries for answering this on squid-users forum. He said:

Curl is attempting to use HTTP/1.1 features which 2.6 does not support (Expect:100-continue, Transfer-Encoding:chunked), and is too old to even have proper workarounds for broken clients. Your request won't work due to these even if PUT was okay.

Please upgrade. squid-2.7/3.1 are still HTTP/1.0 but have some hacks to workaround the HTTP/1.1 features curl is asking for. Squid-3.2 (beta) has HTTP/1.1 support.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.