vinipsmaker / tufao

An asynchronous web framework for C++ built on top of Qt
http://vinipsmaker.github.io/tufao/
GNU Lesser General Public License v2.1
591 stars 179 forks source link

response: No message-body should be sent on a 204 No Content #42

Closed zecke closed 10 years ago

zecke commented 10 years ago

According to the RFC2616 no message-body should be sent when the response code 204 is used. When using keep-alive the .NET stack will break on response parsing after the next request.

Add some hacks to not generate chunked-encoding in the answer and provide a content-length. The code could use some more re-use and the question is what should happen when ::write() or ::end() with data is used on a 204..

vinipsmaker commented 10 years ago

I've choose another approach to fix the problem.

If you don't issue any body, no extra data will be generated no matter which response status code you use. Content-Length: 0 is preferred over Transfer-Encoding: chunked.