skaller wrote:
> On Sun, 2007-04-15 at 09:15 -0700, James Dennett wrote:
>> skaller wrote:
>>> On Sun, 2007-04-15 at 07:47 -0700, James Dennett wrote:
>>>> On 4/15/07, skaller <[EMAIL PROTECTED]> wrote:
>>>>         I can't figure out how to terminate an indefinite length
>>>>         http response .. anyone know?
>>>>         
>>>>         wget keeps retrying after the connection is closed
>>>>         on it, I don't know any other way to signify end of file ..
>>>>
>>>> AFAIK, apart from specifying the Content-Length, the only other
>>>> portable-ish way is to use the "chunked" encoding.  Not sure if
>>>> that's supported by HTTP/1.0, or if it requires HTTP/1.1.  Will
>>>> look into this a little more later; while I've done some HTTP work
>>>> in the past it's an occasional thing for me.
>>> Ok, thanks .. somehow wget is getting confused.. it also
>>> says "No headers" when plainly it got headers.
>> Interesting; has anyone looked at what's being received?
> 
> Well the point is the webserver isn't working and I'm trying
> to find out more by using 
> 
>       wget --debug -O - URL
> 
> Data is being lost on large files: on my box the only the
> 12,000 line formatted regression test (which is 2.8 Meg
> or something). Running on Dreamhost .. no pages
> make it intact. This vaguely looks like something
> is being closed before copying is completed .. but
> it could just be a bug in the read/write routines
> for either sockets or files. Dreamhost also kills the
> thread test which runs the stop-the-world garbage collector,
> so it could also be a threading issue.
> 
> The tools/fcmp doesn't work either,
> that uses async file I/O exclusively.
> 
> Anyhow without seeing a good transfer it's hard to
> analyse a bad one :)
> 
> 
> 
>>> Perhaps the server isn't closing the socket properly..
>>> I think it's using close.
>> It could be that a shutdown() would be better.  (Probably
>> some layer already handles using closesocket for Win32
>> because close doesn't work on sockets in Win32, or didn't
>> last time I looked some years ago.)
> 
> I think it isn't better so much as needed as well.
> As I read my man page, shutdown stops transmission,
> but it doesn't actually *close* the socket.

That's correct.  shutdown is not an alternative to
closing; it's just a politer way of initiating the
end of a connection.  The client can then detect
that end of stream, and can close, which the server
should detect as end of stream and also close
(though it may also want to close after a timeout
period or similar).  I'm not sure that the connection
etiquette is for HTTP.

> I vaguely remember somewhere that if you close a socket
> right after sending .. any buffered data can be lost:
> you have to actually wait until the socket buffer is empty:
> close deletes the socket and its buffer..
> 
> Hmm .. RTFM .. pulls out Stevens .. (gak! a book!)

That's the way to do it!

-- James

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to