httprfc2616

HTTP 1.1 TE header


While reading RFC2616, I came across TE and Transfer Encoding headers for chunked encoding. I have following question on these:

  1. If a HTTP Server rejects a request because of presence of TE header, is it RFC compliant?
  2. If a HTTP Client sends a request with TE header and list of t-codings and q values and once such q value is 1, is it mandatory for HTTP server to send the response data with that encoding, for eg: TE: deflat;q=0.5 gzip;q=1 (Does this mandate server to compress entity data in gzip and send it or can server ignore that and send data in normal way?).
  3. If a HTTP server does not support reception of chunked data (I am aware that it goes against RFC, but is intended), what could be the right error response code to be sent back to the client so that client next time does not send PUT request in chunked fashion.

Thanks in advance for your valuable inputs and answers.


Solution

  • In RFC 7230 it says,

    The "TE" header field in a request indicates what transfer codings,
    besides chunked, the client is willing to accept in response, and
    whether or not the client is willing to accept trailer fields in a
    chunked transfer coding.

    This infers that TE is simply a declaration by the client and can be ignored by next server. There should be no reason for a HTTP server to reject a request with a TE header. If a server does not support chunked then it does not support HTTP 1.1 and therefore should interpret the incoming request as if it were a 1.0 request and respond accordingly. See here.