[ee122] The terminating characters

Lisa Fowler fowler at eecs.berkeley.edu
Sat Sep 22 21:43:00 PDT 2007


On 9/22/07, Simon Tan <simtan at berkeley.edu> wrote:
> * Server receives "GET / HTT". Client is obviously not done, so we wait
> until the next select.
> * Server receives "P/1.0
>
> GET / HT". Server thinks: Hrm, there's a CRLF there;

*warning red alert bwoop bwoop*!  So, wait, where is that CRLF??
Where'd the server find a CRLF?  The client sure didn't send it one in
the situation you offered above....

> But I
> think that this goes against the idea that the server should always close
> the connection after each 'request', thereby throwing away whatever else
> was in the buffer. Also, I would think that if the server was lenient like
> this, garbage could build up in the buffer and the server would never
> close the connection. Please advise.

The server closes connections AFTER receiving full messages (wherein a
"full message" is some gorp followed by a line containing only a
CRLF).  The server would keep the connection open until it thinks it's
received a full request.  It then closes the connection.  So you need
buffers, but you don't need the server to be omniscient nor helpfully
*trying* to make the client's request valid (why?).  It would also
behoove you to make sure your buffers aren't super giant... (why?)

-Lisa


More information about the ee122 mailing list