-
Notifications
You must be signed in to change notification settings - Fork 523
Allows Content-Length for 304 Not Modified response #2321
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're getting good at this 😄
@Tratcher Care to review? Feel free to merge. |
Nice and simple |
@Tratcher I was thinking is that maybe we should verify that the actual length of the response body is zero for 304 responses instead of just skipping the response-body-too-short validation. I didn't bring this up in the PR review because it's a separate issue and we'll probably want to do the same validation for HEAD requests. Do you think this is worth addressing? |
I'm not too familiar with the spec requires wrt this. Is a 304 response ever allowed to have a non-empty response body? |
304 is pretty special, it's a lot like a head request. It explicitly must not have a response body, but it is allowed to describe the body it would have had if it were a 200. |
@halter73 I thought about the response length validation as well, but as you said is a separate issue. Also it can be considered a breaking change. |
We're good then. We already log and ignore response body writes for HEAD requests and 204/205/304 responses. I'm assuming we should not allow a non-zero content length to be set for 204 and 205 responses. |
See here for the logic that decides whether or not to ignore writes to the response body. |
I think we have everything covered. I just wanted someone to agree that allowing a non-zero Content-Length response header for 204 and 205 responses is silly. |
Resolves #2099