chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] http egg and closed persistent connections


From: Drew Hess
Subject: Re: [Chicken-users] http egg and closed persistent connections
Date: Mon, 23 Feb 2009 13:20:19 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin)

John Cowan <address@hidden> writes:

> Drew Hess scripsit:
>
>> Some HTTP servers will drop a connection even when they've indicated
>> it'll be persistent. For example, the nytimes.com web servers send a
>> Connection: keep-alive header when the client sends an HTTP/1.0 request,
>
> Granted that the server shouldn't do that, HTTP/1.0 clients shouldn't
> attach meaning to Connection: keep-alive either, as it is a 1.1
> feature.


OK, being strict about HTTP/1.0 persistent connections is one way to
deal with it. But that's not what http-client does:

(define (is-keep-alive? status as)
  (or (and (substring-ci=? status "http/1.0")
           (string-ci=? (alist-ref "connection" as string=? "") "keep-alive"))
      (and (substring-ci=? status "http/1.1")
           (not (string-ci=? (alist-ref "connection" as string=? "") 
"close")))))

The status passed to is-keep-alive? is from the server, but
http:send-request calls is-keep-alive? regardless of the protocol used
by the client.


> When you say you are a 1.0 client, you should expect to be treated as
> a 1.0 client.


I agree. My code is asking to be treated as a 1.0 client. That's why I
ran into this problem in the first place. I'm not re-using the in and
out ports in subsequent calls to http:send-request. I'm not looking at
the Connection headers sent by the server. I'm not sending any
Connection headers in my request. Because I sent an HTTP/1.0 request and
I'm not re-using the ports, I'm expecting http:send-request to close the
previous connection and open a new one for each subsequent request. But
it's not doing that, and that's causing my client code to break. My
client code should never see an EOF unless there's an actual error.

One way to fix this is by adding the patch I sent (or something
similar). Another way to fix it would be to make http:send-request
ignore keep-alive headers from the server when the *client* request is
HTTP/1.0, and not add the connection to the pool. That doesn't permit
optimizations when the server is willing to keep the connection up, but
either way works for me.

thanks
d

Attachment: pgpL_9lDq4WGq.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]