Re: what got broken in 2.2 kernels' TCP/IP---more weirdness

Martins Krikis (mkrikis@kenan.com)
Thu, 30 Sep 1999 16:20:59 -0400


Thank you all very much for your answers, which were all basically
the same---"you're not reading all the data from the client".

Well, I am. Here is the output the server process produces
(i.e., the things it reads---according to my knowledge of HTTP
that's all there should be):
--------------------------------------------------------------
Listening on port 8889
Accepted a connection on fd 8
Just input: POST / HTTP/1.0
Just input: Referer: http://localhost:8000/localdummy.html
Just input: Connection: Keep-Alive
Just input: User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.13pre14 i586)
Just input: Pragma: no-cache
Just input: Host: localhost:8889
Just input: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Just input: Accept-Encoding: gzip
Just input: Accept-Language: en
Just input: Accept-Charset: iso-8859-1,*,utf-8
Just input: Content-type: application/x-www-form-urlencoded
Just input: Content-length: 0
Just input:
---------------------------------------------------------------

Furthermore, doing another read(fd, line, 1) just returns a 0
and does not help at all. (And it may block unless I'm mistaken.)

However, by an accident I tried some more read()-s and it appears
that the problem goes away if I do two such bogus read()-s before
close(). Both return 0, BTW, i.e., there is no data to read; but
it does help.

What's even more interesting is that doing just one extra read()
for 2 or more bytes also helps. Yes, it still returns 0, i.e., there
is no data.

Thus I now at least have a kludge (possibly a slightly dangerous
one unless I take care of potential blocking (would actually have
to check that taking care of blocking doesn't break the kludge :-))).
I think that my question in the subject may still be valid (since the
problem exists only on Linux 2.2 kernels and no more read()-s
should be necessary there). But actually, I would really like to know
why do 2.2 kernels think there is more data there when there isn't
(and shouldn't be) (assuming that this is what causes the problem);
or is it entirely a bug in both Netscape and IExploder; or a combination
of little bugs on both sides?

Also, I would like to hear the ideal way to deal with this in user
programs. So far I'm not convinced that from this day on I should
be adding a bogus read() for 2 characters before every close() I do...
And even if I shouldn't, I really want to know why this particular
read() that didn't read any characters made any difference...

Thank you very much again for the kludge and hopefully for future
responses as well.

Martin mkrikis@kenan.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/