[144] in 6.033-lab
Re: POST requests
daemon@ATHENA.MIT.EDU (Kevin Fu)
Thu Mar 11 10:10:45 1999
To: 6.033-lab@MIT.EDU
Cc: Stanley Hu <stanhu@MIT.EDU>
In-Reply-To: Your message of Thu, 11 Mar 1999 00:48:54 -0500.
<4.1.19990311003919.00a7a940@po7.mit.edu>
Date: Thu, 11 Mar 1999 10:10:28 EST
From: Kevin Fu <fubob@MIT.EDU>
ok, I made the appropriate fixes in http.c and updated our
distribution. For students who want to patch their own code:
For all cases of "strcmp" in http.c, change it to "strcasecmp" except
for the GET, HEAD and POST headers. RFC 1945 specifies that all
fields (even literals) are case-insensitive unless explicitly defined
as case-sensitive. The GET, HEAD, and POST headers are
case-sensitive.
Please keep the bug reports coming. Likewise, if you find HTML that
crashes our HTML parser, send us the sample HTML. Of course, we will
not penalize you for bugs in our code.
-Kevin
>Date: Thu, 11 Mar 1999 00:48:54 -0500
>To: 6.033-lab-tas@MIT.EDU
>From: Stanley Hu <stanhu@MIT.EDU>
>Subject: POST requests
>
>To get POST requests to work easily, a few changes need to be made in http.c:
>
>Look for the line in http_parseRequest with:
>
> } else if (strcmp(str, "Content-Length") == 0) {
> str = strtok(NULL, CRLF);
> m->content_length = atoi(str);
>
>Since a lot of Web servers user a lowercase "l" in the word "Length", the
>field doesn't get parsed correctly. To remove the case sensitivity,
>replace the strcmp() call with strcasecmp(). (This might go for the rest
>of the fields too, but POST requests must have a correct Content-Length to
>work right.)
>
>It might also be helpful to add these lines in the http_unparseRequest too:
>
> if (m->content_length > 0) {
> sprintf(p, "Content-Length: %d%s", m->content_length, CRLF);
> p += strlen(p);
> }
--------
Kevin E. Fu (fubob@mit.edu)
PGP key: finger fubob@monk.mit.edu