cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem understanding Keep-Alive and Squid

From: Mohamed Lrhazi <lrhazi_at_gmail.com>
Date: Mon, 22 May 2006 13:02:53 -0400

Thanks a lot jamie,

While stuck on this issue I tried programming and sending the PURGE
requests with the Keep-Alive headers myself.. I am using Twisted
Python. it seems to work fine so far.

Mohamed~

On 5/22/06, Jamie Lokier <jamie_at_shareable.org> wrote:
> Mohamed Lrhazi wrote:
> > I actully dud this by hand and it seems Squid works fine:
> >
> > telnet 10.0.4.2 80
> > Trying 10.0.4.2...
> > Connected to 10.0.4.2.
> > Escape character is '^]'.
> > PURGE http://yaqb.org/test-cache/test.html HTTP/1.1
> > Proxy-Connection: Keep-Alive
> >
> > HTTP/1.0 404 Not Found
> > Server: squid/2.5.STABLE13
> > Mime-Version: 1.0
> > Date: Sun, 21 May 2006 21:43:42 GMT
> > Content-Length: 0
> >
> > PURGE http://yaqb.org/test-cache/test.html HTTP/1.1
> > Proxy-Connection: Keep-Alive
> >
> > HTTP/1.0 404 Not Found
> > Server: squid/2.5.STABLE13
> > Mime-Version: 1.0
> > Date: Sun, 21 May 2006 21:43:56 GMT
> > Content-Length: 0
> >
> >
> > As you can see it does not close the connection so I could send an
> > other request.
> > Why is the connection closed when using cURL?
>
> cURL closes the connection because Squid is not sending
> "Proxy-Connection: keep-alive" in the response.
>
> Curiously, when I try the same thing with Squid
> 2.5.STABLE1-9.10.legacy (from Fedora Legacy), it _does_ send
> "Proxy-Connection: keep-alive" for PURGE requests that return 404 status.
>
> You might report it as a bug in Squid 2.5, or find out if it was sent
> by an earlier version of Squid and removed for some reason.
>
> For your specific problem, you could modify libcurl to behave as if
> "Proxy-Connection: keep-alive" was sent anyway. Or modify it to
> assume the response from Squid is HTTP/1.1 (instead of HTTP/1.0), in
> which case the "Proxy-Connection: keep-alive" is not required. Either
> way, you should be careful only to use the modified libcurl for this
> specific problem and not for other things, as it won't function
> correctly in general.
>
> -- Jamie
>

-- 
``We have now sunk to a depth at which restatement of the obvious is
the first duty of intelligent men.''
-George Orwell
Received on 2006-05-22