httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <hart...@ooo.lanl.gov>
Subject Re: change LF to CRLF ?
Date Tue, 21 Mar 1995 08:46:54 GMT
> 
> On Mon, 20 Mar 95 16:54:09 MST, Rob Hartill wrote:
> > The offending bit of code wasn't in stream.c, it was in
> > scan_script_header()
> >
> >        if (p > 0 && w[p-1] == '\n')
> >        {
> >            if (p > 1 && w[p-2] == '\015') w[p-2] = '\0'; 
> >            else w[p-1] = '\0';
> >        }
> >        if(w[0] == '\0') return is_url(location);
> >
> >
> >should be,
> >
> >        if (p > 0 && w[p-1] == LF)
> >            w[p-1] = '\0';
> >
> >        if(!w[0] || (p>0 && w[0] == CR && !w[1])) return is_url(location);
> >
> >I suppose. 
> 
> Sorry, Rob, no. There was nothing wrong with that code. You are assuming
> that the CGI script will return CRLF terminated headers. This assumption
> will be wrong for the vast majority of CGI scripts.

Hmm, I tried it with a CGI script that output LF with no CR. The
result was output of a LF with no CR  - which I'd consider to be
correct. Even though the spec calls for CRLF, I don't think the
server should be changing the cgi output.

Unless there is a problem elsewhere, the 'fix' I gave was only
leaving CRs where they belong, instead of removing or adding them.

I can see that correcting the cgi headers would be useful, but I'm
not sure it's the right thing to do here. Neither method should break
anything, but it's just my gut feeling that cgi supplied info should be
passed as-is.

rob

Mime
View raw message