Mixing buffered and unbuffered I/O to support CONNECT method?

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."
.............................................................................
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top