[MERGE] Don't require Content-Type

Robert Collins robertc at robertcollins.net
Fri Oct 13 07:06:13 BST 2006


On Wed, 2006-10-11 at 19:05 +1000, John Arbash Meinel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> We have bug:
> https://launchpad.net/products/bzr/+bug/62473
> 
> Where Cherokee doesn't return the 'Content-Type' header if it doesn't
> know it. We currently require the Content-Type header, because that is
> where you store the 'multipart/bytes' information to distinguish a
> multipart response versus a single range response.

RFC2616 7.2.1 Type
...
   Any HTTP/1.1 message containing an entity-body SHOULD include a
   Content-Type header field defining the media type of that body. If
   and only if the media type is not given by a Content-Type field, the
   recipient MAY attempt to guess the media type via inspection of its
   content and/or the name extension(s) of the URI used to identify the
   resource. If the media type remains unknown, the recipient SHOULD
   treat it as type "application/octet-stream".

> Anyway, we need to decide if we want to support a missing
> 'Content-Type', it doesn't seem to be required by the http spec, and the
> only thing we use it for at the moment is checking whether a range
> response is a multipart response, or a single-range response.

We must support it missing, because the server only SHOULD send it. We
dont need to try to guess - assuming application/octet-stream is safe.

> The attached patch just changes it so that if there is no Content-Type,
> then it cannot be multipart.
> 
> It is a small change, and comes with tests, so if we decide to support
> it, I don't see why it couldn't be merged for bzr-0.12.

I would like the comment changed to refer to section 7.2.1 of rfc2616,
and say something like "When there is no content-type header we treat
the response as being of type 'application/octet-stream as per RFC2616
section 7.2.1."

<http-guru/>


-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061013/0cdb0288/attachment.pgp 


More information about the bazaar mailing list