On Mon, Feb 23, 2009 at 01:44:10PM -0800, Drew Hess wrote:
> I think that http-client should look for ("Connection" . "close") in
> the client's request headers and close the connection explicitly upon
> finishing the request. It doesn't do that right now. If the server
> doesn't respond with a "close" of its own, http:send-request will add
> the connection to the pool.

You're right, this is wrong.  Actually, I think that if the server sends
("Connection" . "close") _after_ the first conversation, it doesn't
remove the connection from the pool either.

> It's not exactly a trivial change to make because the client request
> headers aren't in scope when http:send-request decides what to do with
> the connection, but it shouldn't be too bad to fix.

They're not?  I think they're named AS by the outermost let* expression.
Could you please try if the attached patch does the trick for you?

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth
Index: http-client.scm
===================================================================
--- http-client.scm     (revision 13405)
+++ http-client.scm     (working copy)
@@ -259,9 +259,13 @@
                                (make-property-condition 'net))))
                      ((and in out))
                      ((and (string? header)
-                           (is-keep-alive? header a))
-                      (or (is-connected? id) (add-connection! id i o)))
+                           (is-keep-alive? header a)   ; server
+                           (is-keep-alive? header as)) ; client
+                      (unless (is-connected? id)
+                        (add-connection! id i o)))
                      (else
+                      (when (is-connected? id)
+                        (close-connection! id))
                       (set-finalizer! i close-input-port)
                       (set-finalizer! o close-output-port) ) )
                (values header a i o)))

Attachment: pgpyCVjhbzUaQ.pgp
Description: PGP signature

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to