Request for code review of varnish-cache.org ticket #780 (Read CRLF in fetch_chunked)

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Oct 18 16:52:55 CEST 2010


In message <AANLkTini5iUYXYw1T+k1yh5vmxU+3Ld7ApEy9y0yXDOf at mail.gmail.com>, Mart
in Blix Grydeland writes:

>Attached is code proposed to resolve ticket #780 on vanish-cache.org. 

Looks good, but I'm worried if it is too strict.

RFC2616 p166 "19.3 Tolerant Applications" suggest that we don't mandate
exact CR+LF, but rather:

   The line terminator for message-header fields is the sequence CRLF.
   However, we recommend that applications, when parsing such headers,
   recognize a single LF as a line terminator and ignore the leading CR.

So I think the right logic is more like:

	c = Rx one char
	if (c == CR)
		Rx one char
	if (c != LF)
		accept fetch
		log error notice
		close connection to prevent reuse
	
-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.




More information about the varnish-dev mailing list