On 22-Feb-08, at 12:16 PM, Guillaume Cartier wrote:
In my web-server when I receive a request, the code to parse that request that is very natural goes something like :
- read-line until received an empty line to read the headers
- read-subu8vector to read the body that could be anything
Problem is that the doc states that read-subu8vector should *not* be used after character input operations have been done on the port because otherwise the character-stream and byte-stream may be out of sync due to the port buffering. Is there any work around this limitation? (of course it is possible to modify the code not to do any character input operations but it becomes less elegant)
The "trick" is to disable the character buffering on the port, so that there is no unread text when you start reading with read-subu8vector. That's the price to pay for efficiency (a simpler model to use would be to never use buffering on any port, but that would be inefficient in the common case where you are reading only text).
Marc