[Top][All Lists]

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

Re: [PATCH] web: http: Accept blank Content-Type headers.

From: Mark H Weaver
Subject: Re: [PATCH] web: http: Accept blank Content-Type headers.
Date: Mon, 27 Jul 2015 17:05:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

David Thompson <address@hidden> writes:

> I encountered a bug in the HTTP header parsing bug when trying to
> download a file via Guix.  The response had a Content-Type header, but
> with no value, like so:
>     Content-Type: 
> From reading the W3C spec[0], an unknown Content-Type header can be
> treated as if it were an application/octet-stream type.

An empty string is not merely an "unknown" Content-Type header.  It is
blatantly invalid syntax.  It would be good to contact the web site
owner and ask them to fix it.

Since web clients seem to accept just about anything these days, and web
servers have adapted to this by producing garbage, it may be that we
need to add a "permissive" mode that sifts through the garbage and uses
heuristics to try to make some sense of it.

However, I'm not sure it makes sense to handle this particular case of
an empty Content-Type header specially, at that this place in the code.
Do we have any other examples of this particular error?

I realize that it's more work, but I would prefer to retain a mode that
reports errors (possibly making a few compromises for very widespread
errors), and then to somehow implement another mode that accepts
*anything* and does its best to make sense of it.

What do you think?

Thanks for working on it,


reply via email to

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