chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] with-input-from-request does not close SSL socket


From: Peter Bex
Subject: Re: [Chicken-users] with-input-from-request does not close SSL socket
Date: Wed, 14 Dec 2011 15:24:36 +0100
User-agent: Mutt/1.4.2.3i

On Wed, Dec 14, 2011 at 03:16:57PM +0100, address@hidden wrote:
> I use the http-client egg to send queries to a HTTPS server:
> 
> (with-input-from-request
> "https://server/some/url";
> search
> (lambda ()
>   (ssax:xml->sxml (current-input-port) '()))))
> 
> For every connection I get an CLOSE_WAIT with 38 bytes in the receive queue:
> 
> Proto Recv-Q Send-Q Local Address               Foreign Address
>      State
> tcp       38      0 2.11.152.42:45237           10.100.26.82:443
>      CLOSE_WAIT
> 
> This looks to me as if with-input-from-request fails to close the
> socket, which is probably a bug.

This is expected.  The http-client egg tries to use HTTP/1.1 if it's
supported and re-use the connection to pipeline requests.  This saves
on TCP/IP handshake overhead and in the case of SSL saves even more
overhead for the SSL negotiation.

> As a work around I need a way to close the socket. How can I access
> the socket to force closing it?
> 
> I tried to use close-connection! this way:
> 
>       (let ((result (with-input-from-request
>                      uri search
>                      (lambda ()
>                        (ssax:xml->sxml (current-input-port) '())))))
>         (close-connection! uri)
>         result))
> 
> But this does not have any effect.

Hm, that ought to work.  Perhaps there's a bug in the openssl egg.
I'll have a look at it later.

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



reply via email to

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