cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem understanding Keep-Alive and Squid

From: Jamie Lokier <jamie_at_shareable.org>
Date: Mon, 22 May 2006 13:37:36 +0100

Mohamed Lrhazi wrote:
> I need to send PURGE requests to Squid servers and would like it all
> to happen pipelined using HTTP Keep-Alive...
> When I try using GET method, keep alive seems to work fine:
>
> Testing libcurl/7.15.3 OpenSSL/0.9.8b zlib/1.1.4
> DEBUG: 0: About to connect() to proxy 10.0.4.2 port 80
> DEBUG: 0: Trying 10.0.4.2...
> DEBUG: 0: connected
> DEBUG: 0: Connected to 10.0.4.2 (10.0.4.2) port 80
> DEBUG: 2: GET http://yaqb.org/test-cache/test.html HTTP/1.1
> DEBUG: 2: User-Agent: PycURL/7.15.3
> DEBUG: 2: Host: yaqb.org
> DEBUG: 2: Pragma: no-cache
> DEBUG: 2: Accept: */*
> DEBUG: 2: Proxy-Connection: Keep-Alive
> DEBUG: 1: HTTP/1.0 200 OK
> DEBUG: 1: Server: Zeus/4.3
> DEBUG: 1: Date: Sun, 21 May 2006 21:32:26 GMT
> DEBUG: 1: Content-Length: 29
> DEBUG: 1: Accept-Ranges: bytes
> DEBUG: 1: Content-Type: text/html
> DEBUG: 1: Last-Modified: Sun, 21 May 2006 04:32:45 GMT
> DEBUG: 1: X-Cache: MISS from yscache2.your-site.com
> DEBUG: 0: HTTP/1.0 proxy connection set to keep alive!
> DEBUG: 1: Proxy-Connection: keep-alive
> DEBUG: 0: Connection #0 to host 10.0.4.2 left intact
>
>
> When switch to method PURGE using: c.setopt(c.CUSTOMREQUEST,'PURGE')
> I then get:
>
> Testing libcurl/7.15.3 OpenSSL/0.9.8b zlib/1.1.4
> DEBUG: 0: About to connect() to proxy 10.0.4.2 port 80
> DEBUG: 0: Trying 10.0.4.2...
> DEBUG: 0: connected
> DEBUG: 0: Connected to 10.0.4.2 (10.0.4.2) port 80
> DEBUG: 2: PURGE http://yaqb.org/test-cache/test.html HTTP/1.1
> DEBUG: 2: User-Agent: PycURL/7.15.3
> DEBUG: 2: Host: yaqb.org
> DEBUG: 2: Pragma: no-cache
> DEBUG: 2: Accept: */*
> DEBUG: 2: Proxy-Connection: Keep-Alive
> DEBUG: 1: HTTP/1.0 200 OK
> DEBUG: 1: Server: squid/2.5.STABLE13
> DEBUG: 1: Mime-Version: 1.0
> DEBUG: 1: Date: Sun, 21 May 2006 21:32:57 GMT
> DEBUG: 1: Content-Length: 0
> DEBUG: 0: Closing connection #0
>
>
> Is it cURL or Squid that causes Keep-Alive to not be used when I
> swtich the HTTP method from GET to PURGE?

It's Squid. Notice how in the first trace, Squid responds with
"Proxy-Connection: keep-alive". In the second, Squid doesn't sent
that header.

Curl is doing the right thing, for a proxy which claims to be using
HTTP/1.0.

-- Jamie
Received on 2006-05-22