Jules
Jules

Reputation: 15199

What to do if HTTP TRACE request has body?

I'm implementing a special-purpose HTTP server, and have stumbled across a scenario where I can't work out what the RFC wants me to do. Clients MUST NOT send a TRACE request with a body (cf Section 9.8). But if a client sends a body-related header in a TRACE request (i.e. a Content-Length or Transfer-Encoding header), I seem to have two options for how to make the server behave:

  1. Read the illegal body and ignore it
  2. Treat the headers the same as a client would treat the response to a HEAD method, i.e. as information about a body that hasn't been included, and assume therefore that there is no body.

I don't see anything in the RFC that favours either solution. So, which should I take? Is there another alternative I haven't seen?

Upvotes: 2

Views: 1288

Answers (1)

Julian Reschke
Julian Reschke

Reputation: 42045

You read the body, and then either ignore it, or return a 4xx status code. See http://trac.tools.ietf.org/wg/httpbis/trac/ticket/19.

Upvotes: 1

Related Questions