[squid-users] Unable to test HTTP PUT-based file upload via Squid Proxy

From: Harry Simons <simonsharry_at_gmail.com>
Date: Tue, 15 May 2012 18:09:35 +0530

Hello,

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: The following 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][1], 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.*

Regards,
/HS

  [1]:
http://stackoverflow.com/questions/10568655/unable-to-test-http-put-based-file-upload-via-squid-proxy
Received on Tue May 15 2012 - 12:40:02 MDT

This archive was generated by hypermail 2.2.0 : Wed May 16 2012 - 12:00:04 MDT