lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev HTTP continuation lines


From: Klaus Weide
Subject: Re: lynx-dev HTTP continuation lines
Date: Thu, 4 Feb 1999 10:29:12 -0600 (CST)

On Thu, 4 Feb 1999, David Coles wrote:

> Hi all,
> 
> think I have found a bug in the implementation of the HTTP protocol:
> 
> If I have interpreted the W3C HTTP spec correctly, a header line beginning
> with a space is a continuation of the previous line, so if an incorrectly
> written cgi script produced:
> 
> HTTP/1.0 200 OK
> Date: Thu, 04 Feb 1999 14:45:34 GMT
> Server: Apache/1.1.3
> Content-type: text/plain
> Set-Cookie: Apache=banks6086918139534767; path=/
>  Content-Type: text/html                        
> 
> The content type of the document should be text/plain (as introduced by
> the web server as a default).

Yes.

> The script is incorrect in that the person
> who has written it has used a here document and indented it to make it
> look pretty - what he wanted was to produce an HTML doc, but he's ended up
> with a plain text doc - according to the HTTP spec anyway...
> 
> If I look at this document in lynx, it gives me an HTML document. I
> believe this to be wrong.

Interesting.  I agree it's wrong.  I always assumed lynx would get this
right - the presence of this piece of code

    case miNEWLINE:
        if (c != '\n' && WHITE(c)) {            /* Folded line */
            me->state = me->fold_state; /* pop state before newline */
            break;
        }

in the state machine that handles header parsing made me assume that.
Well it shows that someone at some point has at least thought about
folded header lines.  I guess there was never a need to test whether
it actually works - especially if most other browsers are broken in
the same way, so no server can rely on the proper parsing by clients...

> As something to support this, if I set Lynx up to go through an Apache
> proxy server, Apache tries to be helpful by catenating the continuation
> line onto the end of the previous line, so the header looks like:
> 
> HTTP/1.0 200 OK                                                               
>   
> Date: Thu, 04 Feb 1999 14:52:06 GMT                                           
>   
> Server: Apache/1.1.3                                                          
>   
> Content-type: text/plain                                                      
>   
> Set-Cookie: Apache=banks6709918139926328; path=/ Content-Type: text/html      
>   
> 
> which lynx then correctly interprets as a plain text document.
> 
> If it's any consolation every other browser I know of has this problem,
> which made me think I was going mad for a while, but then I thought they
> must all be using the same reference code from W3C - so perhaps that is
> buggy.

I tried a couple old Linemode Browser binaries on your URL;

WWW LineMode Browser version 2.15 (WWW Library 2.17):
   gets it wrong, i.e. treats as text/html

W3C Line Mode Browser version 4.0D:
   gets it right, i.e. treats as text/plain

Well now you know of at least one browser that doesn't have that
problem :) I would expect this also applies to other clients based on
the newer W3C Library, e.g. Arena.

> The address for an example of this is
> 
> http://firth.natcorp.ox.ac.uk/cgi-bin/jtap/test.pl
> 
> please let me know what you think. I'm quite willing to believe I have
> made a mistake here, but no-one I have talked to about it could point it
> out to me.

I think you are quite right.  Your example of course is especially bad
if you are trying to get client authors to fix this, since the fix
will appear to break something that appeared to work right before...

The HTTP/1.1 Feature Reports at

    URL: http://www.w3.org/Protocols/HTTP/Forum/Reports/

don't have header folding as an item to check - if they had, this
would probably have been caught, and there would be by now some more
browsers behaving differently.  You may want to bring this to the
attention of the http-wg.

    Klaus


reply via email to

[Prev in Thread] Current Thread [Next in Thread]