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

From: Harry <simonsharry_at_gmail.com>
Date: Wed, 16 May 2012 22:53:16 -0700 (PDT)

Amos Jeffries-2 wrote
>
> On 16.05.2012 00:39, Harry Simons wrote:
> <snip>
>>
>> **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
>>
> <snip>
>
> 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.
>
> Amos
>

I have not upgraded Squid (yet). But, now, when I try to issue a simple,
manually constructed PUT request via socat (shown below), there's no output
from socat.

1. First, I tested my PUT request (and WEB-SERVER's ability to accept it) by
issuing it straight to the WEB-SERVER, like so:

    $ cat put.req # The PUT request to send a 3-character file containing
'xyz'
    PUT http://WEB-SERVER/upload/sample.put HTTP/1.0
    Host: WEB-SERVER
    Content-Type: text/plain
    Content-Length: 3
    
    xyz
    $ cat put.req | socat - TCP:WEB-SERVER:80
    HTTP/1.1 201 Created
    Date: Thu, 17 May 2012 05:34:03 GMT
    Server: Apache/2.2.22 (Fedora)
    Location: http://WEB-SERVER/upload/sample.put
    Content-Length: 263
    Connection: close
    Content-Type: text/html; charset=ISO-8859-1
    
    <!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML 2.0//EN&quot;>
    <html><head>
    <title>201 Created</title>
    </head><body>
    
Created

    <p>Resource /upload/sample.put has been created.</p>
    <hr />
    <address>Apache/2.2.22 (Fedora) Server at WEB-SERVER Port 80</address>
    </body></html>
    $

2. Then, I verified the file and its contents on the WEB-SERVER: the file
did in fact get put successfully.

    $cat /var/www/html/upload/sample.put
    xyz$
    $

3. Then, I issued the same PUT but this time routing it via the Squid proxy,
like so:

    $ cat put.req | socat - TCP:SQUID-PROXY:3128
    $

As you can see, there was no output this time.

Would appreciate if you or someone could tell me what I'm doing wrong here.

Regards,
/HS

--
View this message in context: http://squid-web-proxy-cache.1019090.n4.nabble.com/Unable-to-test-HTTP-PUT-based-file-upload-via-Squid-Proxy-tp4634404p4642584.html
Sent from the Squid - Users mailing list archive at Nabble.com.
Received on Thu May 17 2012 - 05:53:20 MDT

This archive was generated by hypermail 2.2.0 : Thu May 17 2012 - 12:00:05 MDT