[Top][All Lists]

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

Re: [Chicken-users] Hang problem with the http egg.

From: Hans Bulfone
Subject: Re: [Chicken-users] Hang problem with the http egg.
Date: Wed, 12 Mar 2008 20:47:08 +0100
User-agent: Mutt/1.5.16 (2007-06-09)


On Wed, Mar 12, 2008 at 08:45:31AM -0700, Robin Lee Powell wrote:
> On Wed, Mar 12, 2008 at 08:22:48AM -0700, Robin Lee Powell wrote:
> > If something is choking on the lack of newline, it's in the http
> > egg.
> Except apparently not; apparently it's quite a bit lower-level than
> that.  Here's some code I added:
> (let loop ()
>   (format #t "eof: ~A.\n" (eof-object? input))
>   (format #t "ready: ~A.\n" (char-ready? input))
>   (format #t "peek-char: ~A.\n" (peek-char input))
>   (cond
>     [(eof-object? input) noop]
>     [(format #t "read-char: ~A.\n" (read-char input))
>      (loop)]))
> What's happening is that eof never returns true, even though the
> port is closed.  ready returns #f, and the next operation (either
> peek-char or read-char, I've tried both) hangs.

eof-object? is imho not meant to be called with a port.

when a port is at eof, peek-char and read-char return a special
end-of-file object that can be tested with eof-object?
what you want is imho:
(eof-object? (peek-char input))
(and (char-ready? input)
     (eof-object? (peek-char input)))
which doesn't hang when there's no data available but the connection
is still open.

is the connection actually closed by the server?  the tcpdump output
you posted imho doesn't indicate that it is closed.

if the connection is not closed by the server it imho means this is a
bug in the server that is somehow triggered by the request like peter
bex already pointed out.  e.g. probably curl and wget are sending
http/1.1 requests, not 1.0 like the http egg.

> I'm kind of stuck at this point; I can make my own string collector
> that stops when char-ready? is #f, but there seems to be a more
> general problem here.

that imho wouldn't work when the response is longer.  you then get
only the data that is immediately available.


reply via email to

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