J
James Marshall
I'm trying to write an HTTP proxy that supports the CONNECT method. This
requires first reading the textual request line and headers, and then
reading binary data that must be read and sent _immediately_ after being
written by the client. Thus, using read() won't work, because it blocks
until the buffer is full. However, the text headers are most
appropriately read using <>, and we have dire warnings not to mix buffered
reads with sysread() on the same socket.
So what's the preferred method of reading line-oriented text input
followed by unbuffered binary data on the same socket? I've used read()
in the past, but I guess I've just been lucky enough to get away with it!
Also, does anyone here know what the "heavy wizardry" is that the Camel
book mentions, regarding mixing of read() and sysread()? That may be one
solution.
Thanks a lot!
James
.............................................................................
James Marshall (e-mail address removed) Berkeley, CA @}-'-,--
"Teach people what you know."
.............................................................................
requires first reading the textual request line and headers, and then
reading binary data that must be read and sent _immediately_ after being
written by the client. Thus, using read() won't work, because it blocks
until the buffer is full. However, the text headers are most
appropriately read using <>, and we have dire warnings not to mix buffered
reads with sysread() on the same socket.
So what's the preferred method of reading line-oriented text input
followed by unbuffered binary data on the same socket? I've used read()
in the past, but I guess I've just been lucky enough to get away with it!
Also, does anyone here know what the "heavy wizardry" is that the Camel
book mentions, regarding mixing of read() and sysread()? That may be one
solution.
Thanks a lot!
James
.............................................................................
James Marshall (e-mail address removed) Berkeley, CA @}-'-,--
"Teach people what you know."
.............................................................................