lint doesn't allow Content-Length: 0 without Content-Type

Issue #37 resolved
Gregory Szorc
created an issue currently raises an assertion on responses with Content-Length: 0 but no Content-Type. Obviously, Content-Type would have no meaning if c-l is 0.

Per RFC 2616 14.13: Any Content-Length greater than or equal to zero is a valid value.

The spec does not AFAIK forbid sending Content-Length: 0 on any HTTP response that could have a body. People may say "but if there is no body, you should send a 201, 204, or 304." Yes, possibly. But, it isn't wrong to not send those. And, FWIW, there are semantic differences between a 200 and 204 as it pertains to the behavior of the user agent.

In, I was able to patch this trivially by changing the last few lines to:



if code not in NO_MESSAGE_BODY and length is not None and length > 0: assert 0, "No Content-Type header found in headers (%s)" % headers }}}