Jon Smirl wrote:
I was basing the code on this. With a zero for EOF you can't tell
whether their isn't data available or if the socket is closed. Zero at
EOF is fine, but it needs to return NS_BASE_STREAM_CLOSED for the
result value.
Hmm. The comments don't match the code.
* Determine number of bytes available in the stream. A non-blocking
* stream that does not yet have any data to read should return 0 bytes
* from this method (i.e., it must not throw the NS_BASE_STREAM_WOULD_BLOCK
* exception).
This disagrees with:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/base/src/nsSocketTransport2.cpp&rev=1.41&mark=285,304#270
:-/
darin, is the code or the documentation wrong here?
Is there any way to peek at the data? If I can't peek at the data I
need to implement my own buffering. With a peek function I can leave
it in the stream buffer. I'm looking for the \n\n\ at the end of the
headers so that I can start header parsing.
Use ReadSegments, and return a zero read count. That said, that is not
guaranteed to get you all the available data...
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network