[ee122] Proj 1 - CRLF questions

Lisa Fowler fowler at eecs.berkeley.edu
Tue Sep 25 12:49:55 PDT 2007


~~~~~~~PLEASE READ THIS ALL THE WAY THROUGH~~~~~~~

Daniel and I just talked about the CRLF issue.  There has been a lot
of confusion about this, so here is the FINAL VERDICT.  First, the
grading.  Then what we were *really* looking for.

Since it was unclear, for grading, if you treat:

    foofoofoofoo\r\n

as a complete request, you will *not be penalized*.  That means, if
your server receives

    foofoofoofoo\r\n

with no blank line following, and processes it, that is OKAY.  If you
do NOT look for a blank line (CRLF), your server will take any input
up to a CRLF, process that info up to the CRLF, discard any remaining
input, and close the connection.  For example, if the server receives:

    GET \index.html HTTP/1.0\r\n
    hi i am junk text\r\n
    \r\n

The server, if it is NOT looking for a blank line, should process the
valid GET request

    GET \index.html HTTP/1.0\r\n

 and DISCARD the remaining text.


----------------------------------

What we were REALLY looking for is described in the following (and I
will talk about this more tomorrow in lecture when I talk about the
Web):

A FULL HTTP REQUEST is:
-------------------------
|  Request-Line     |
|  Headers              |
|  CRLF                   |
|  Body                    |
-------------------------

You are NOT supporting a full request in this milestone.  You were
supposed to support a PARTIAL form of the request (with no headers and
no body)t:

Partial HTTP Request:
-------------------------
|  Request-Line     |
|  CRLF                   |
-------------------------

When we said "blank line", this is that CRLF that we were looking for.
 It is this blank line (CRLF) that makes sure that your client can
connect to "real" web servers (e.g. www.berkeley.edu).

The Request-Line is exactly as specified in the grammar, and thus ends
with a CRLF.  Therefore a complete Partial HTTP Request would end in
CRLFCRLF.

If you DID NOT DO THIS, DO NOT WORRY about it for this milestone.
However, it will be CRITICAL for the second milestone, so DON'T undo
this support if you already put it in.



-----------------

So what happens with consecutive requests or lines of input?  e.g.

    GET /index.html HTTP/1.0\r\n
    GET /superspam.html HTTP/1.0\r\n
    \r\n

(1)  If you do not require the extra CRLF, then your server should
process the first line up to the \r\n, discard the rest of the input,
and close the connection.

(2) If you DO require an extra CRLF, you should return an error that
there was "spurious text" after the Request-Line.


e.g.

    GET /index.html HTTP/1.0\r\n
    \r\n
    here is more junk\r\n

(1)  If you do not require the extra CRLF, then your server should
process the first line up to the \r\n, discard the rest of the input,
and close the connection.

(2) If you DO require an extra CRLF, then your server should process
the request up to the blank line, discard the rest of the input, and
close the connection.


More information about the ee122 mailing list