Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpServerKeepAliveHandler closes connection on 204 response #6549

Closed
sschepens opened this issue Mar 16, 2017 · 1 comment
Closed

HttpServerKeepAliveHandler closes connection on 204 response #6549

sschepens opened this issue Mar 16, 2017 · 1 comment
Assignees
Labels

Comments

@sschepens
Copy link

Expected behavior

Netty Http Server responds 204 without body, maintaining the connection open.

Actual behavior

HttpServerKeepAliveHandler closes the connection unless the response is Informational or has Content-Length set, but 204 responses are not Informational but should not carry a Content-Length header rfc.

A server MUST NOT send a Content-Length header field in any response
   with a status code of 1xx (Informational) or 204 (No Content).  A
   server MUST NOT send a Content-Length header field in any 2xx
   (Successful) response to a CONNECT request

A condition regarding 204 responses should be added here.

Steps to reproduce

Create Http Server adding https://github.com/netty/netty/blob/149916d052180dd2b0e0e98598f349454ea200ba/codec-http/src/main/java/io/netty/handler/codec/http/HttpServerKeepAliveHandler.java#L115

Send a 204 response without body and Content-Length.

@Scottmitch Scottmitch self-assigned this Mar 30, 2017
Scottmitch added a commit to Scottmitch/netty that referenced this issue Mar 30, 2017
… keepalive

Motivation:
https://tools.ietf.org/html/rfc7230#section-3.3.2 states that a 204 response MUST NOT include a Content-Length header. If the HTTP version permits keep alive these responses should be treated as keeping the connection alive even if there is no Content-Length header.

Modifications:
- HttpServerKeepAliveHandler#isSelfDefinedMessageLength should account for 204 respones

Result:
Fixes netty#6549.
@Scottmitch
Copy link
Member

see #6587

Scottmitch added a commit that referenced this issue Apr 1, 2017
… keepalive

Motivation:
https://tools.ietf.org/html/rfc7230#section-3.3.2 states that a 204 response MUST NOT include a Content-Length header. If the HTTP version permits keep alive these responses should be treated as keeping the connection alive even if there is no Content-Length header.

Modifications:
- HttpServerKeepAliveHandler#isSelfDefinedMessageLength should account for 204 respones

Result:
Fixes #6549.
liuzhengyang pushed a commit to liuzhengyang/netty that referenced this issue Sep 10, 2017
… keepalive

Motivation:
https://tools.ietf.org/html/rfc7230#section-3.3.2 states that a 204 response MUST NOT include a Content-Length header. If the HTTP version permits keep alive these responses should be treated as keeping the connection alive even if there is no Content-Length header.

Modifications:
- HttpServerKeepAliveHandler#isSelfDefinedMessageLength should account for 204 respones

Result:
Fixes netty#6549.
kiril-me pushed a commit to kiril-me/netty that referenced this issue Feb 28, 2018
… keepalive

Motivation:
https://tools.ietf.org/html/rfc7230#section-3.3.2 states that a 204 response MUST NOT include a Content-Length header. If the HTTP version permits keep alive these responses should be treated as keeping the connection alive even if there is no Content-Length header.

Modifications:
- HttpServerKeepAliveHandler#isSelfDefinedMessageLength should account for 204 respones

Result:
Fixes netty#6549.
pulllock pushed a commit to pulllock/netty that referenced this issue Oct 19, 2023
… keepalive

Motivation:
https://tools.ietf.org/html/rfc7230#section-3.3.2 states that a 204 response MUST NOT include a Content-Length header. If the HTTP version permits keep alive these responses should be treated as keeping the connection alive even if there is no Content-Length header.

Modifications:
- HttpServerKeepAliveHandler#isSelfDefinedMessageLength should account for 204 respones

Result:
Fixes netty#6549.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants