httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@ast.cam.ac.uk (David Robinson)
Subject Re: BSDI compilation of apache .001
Date Sun, 12 Mar 1995 14:21:00 GMT
>From: rst@ai.mit.edu (Robert S. Thau)
>Date: Sun, 12 Mar 95 09:02:39 EST

>   Date: Sat, 11 Mar 1995 15:58:35 -0800 (PST)
>   From: Brian Behlendorf <brian@wired.com>
>   Diving in, I determined that scripts that put "\r\n\r\n" inbetween the
>   HTTP headers (CRLFCRLF in other words) and the data produce a 500 server
>   error...
>This is probably due to the change in scan_script_header to use
>fgets() instead of the util.c getline() (the infamous single-character
>read routine); something in EOL handling there is presumably broken.
>
>The Right Thing is for the server to change the script-supplied
>headers to internet EOL conventions from the Unix conventions, if the
>script supplies the latter (if only because almost every script out
>there just uses \n).

Sorry about this, my fault. The top of scan_script_header should have read
int scan_script_header(FILE *f, FILE *fd) {
    char w[MAX_STRING_LEN];
    char *l;
    int p;

    while(1) {
/* why did this use getline, when we can use stdio buffered I/O?? */
/* maybe we should put a timeout on this. */
	if (fgets(w, MAX_STRING_LEN-1, f) == NULL)
            die(SERVER_ERROR,"httpd: malformed header from script",fd);
	p = strlen(w);
	if (p > 0 && w[p-1] == '\n')
	{
	    if (p > 1 && w[p-2] == '\015') w[p-2] = '\0';
	    else w[p-1] = '\0';
	}
...

I've tested this, and it fixes the problem.

 David.

Mime
View raw message