Re: line folding - ABNF vs prose

Hi Julian,

On Wed, Jul 27, 2011 at 03:49:35PM +0200, Julian Reschke wrote:
> <http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p1-messaging-15.html#rfc.section.3.2.p.8> 
> says:
> 
> "Historically, HTTP header field values could be extended over multiple 
> lines by preceding each extra line with at least one space or horizontal 
> tab octet (line folding). This specification deprecates such line 
> folding except within the message/http media type (Section 10.3.1). 
> HTTP/1.1 senders MUST NOT produce messages that include line folding 
> (i.e., that contain any field-content that matches the obs-fold rule) 
> unless the message is intended for packaging within the message/http 
> media type. HTTP/1.1 recipients SHOULD accept line folding and replace 
> any embedded obs-fold whitespace with a single SP prior to interpreting 
> the field value or forwarding the message downstream."
> 
> I think we have mismatch between ABNF and prose here. Consider
> 
> "HTTP/1.1 senders MUST NOT produce messages that include line folding 
> (i.e., that contain any field-content that matches the obs-fold rule)...."
> 
> ..but..
> 
>   OWS            = *( [ obs-fold ] WSP )
>                  ; "optional" whitespace
>   obs-fold       = CRLF
> 
> ...which is ok-ish, because the only way to get obs-fold into the field 
> is to have trailing WSP.
> 
> But...
> 
> "HTTP/1.1 recipients SHOULD accept line folding and replace any embedded 
> obs-fold whitespace with a single SP..."
> 
> indicates that a sequence of
> 
>   obs-fold WSP
> 
> should be replaced by
> 
>   SP WSP
> 
> Wasn't the intention to replace the sequence by a single SP?

Replacing with a single SP is harder than replacing with any number of
spaces. For instance, haproxy replaces the CRLF with a comma followed
by a space so that the line is folded without moving a memory block,
and it works quite well.

Maybe the intention was to replace with a single SP but the result is
still valid with multiple spaces, so maybe we should explicitly allow
them ? Anyway good catch on this impact on the ABNF !

Regards,
Willy

Received on Wednesday, 27 July 2011 14:08:25 UTC