3

Is there a minimum set of content-encodings that a http client must support?

Restated: Is a client that only implements content-encoding:identity conformant with standards?

I can't find clear documentation on the subject.

bukzor
  • 37,539
  • 11
  • 77
  • 111
  • 1
    Yes. Set your `Accept-Encoding` & go. Servers refusing to deliver it are also conformant as long as they react with the proper status code. So the question becomes: are you interested in becoming theoretically standards-compliant, or are you asking whether it will work as a client for (most of the) web? (Which I _think_ it does, but I have no data to back up that claim). – Wrikken Jan 25 '14 at 00:27
  • @Wrikken: I'm interested in both, but standards first. An example of such a client is python <3.2 httplib.HTTPConnection. – bukzor Jan 25 '14 at 00:40
  • @Wrikken: Re "yes": what line are you reading? – bukzor Jan 25 '14 at 00:41
  • ah yes, 2 questions in there indeed. "yes" to the 2nd one ;) (And actually the first too: it has a to implement _a_ content-encoding, if only identity, although one could argue no encoding isn't a content-encoding). – Wrikken Jan 25 '14 at 00:54
  • @Wrikken: I was trying to ask which line of which spec are you referencing. – bukzor Jan 25 '14 at 02:37
  • Ah, that, [from here](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3), to lines to read: _"The "identity" content-coding is always acceptable, unless specifically refused... If the Accept-Encoding field-value is empty, then only the "identity" encoding is acceptable."_ which to my says that only accepting identity is fine. However, it also mentions that the server may reply with a `406 (Not Acceptable)`, and that section further one mentions that not _having_ an identity encoding (and no accept-encoding header given) is fine with some recommendations as to what to use then. – Wrikken Jan 25 '14 at 02:47
  • So, in short, as long as you set a `Accept-Encoding: identity`, you are perfectly fine, but may run into a 406 once in a while, but you'd rather have that then a blob of data you can't handle. – Wrikken Jan 25 '14 at 02:49
  • I don't see that that line applies to the case of non-empty accept-encoding. However if a client always sends empty accept-encoding "only `identity` is acceptable." Good and well, but I don't see any MUST/SHOULD for servers sending only "acceptable" content-encodings. – bukzor Jan 25 '14 at 20:02
  • No? _"if the server cannot send a response which is acceptable according to the Accept-Encoding header, then the server SHOULD send an error response with the 406 (Not Acceptable) status code"_ is good enough for me. If it isn't for you, and your require a `MUST` somewhere, well,.. good luck finding it any more explicit in the standards, I cannot find it for you. – Wrikken Jan 26 '14 at 09:07
  • The predicate is false, so the rest is inapplicable; the server can send identity. – bukzor Jan 26 '14 at 17:12
  • Not being a native English speaker, I have to ask: with "the predicate is false", you mean that the server _can_ follow the `Accept-encoding` request? If so I'm confused, because that would make your question _"Is a client that can accept what the server is sending compliant?"_ Or do you mean to send no `Accept-encoding` header? Or a 3rd option I can't think of at this time? – Wrikken Jan 27 '14 at 05:18

1 Answers1

0

No, there's not a minimum set; you don't have to support any if you don't want to.

Note that in SPDY, this isn't the case; they require you to support gzip. This may be the case in HTTP/2 as well, depending on how discussions go there.

Mark Nottingham
  • 5,546
  • 1
  • 25
  • 21
  • By "not any" do you actually mean "only identity"? Also, what can I cite when trying to convince others of this? – bukzor Feb 20 '14 at 17:02
  • Strictly by the book, if you don't support anything, you ought to send "identity", yes. See: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-5.3.4 – Mark Nottingham Feb 21 '14 at 01:58
  • As far as I can see, that spec doesn't specify any minimum content-encoding implementation for clients. That's not quite the same as saying that the spec allows for clients which do not support gzip. – bukzor Feb 21 '14 at 21:39