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

Do not close client connection after returning HTTP status code 304 #963

Merged
merged 8 commits into from
Nov 21, 2024

Conversation

mmatczuk
Copy link
Contributor

No description provided.

internal/martian/flush.go Outdated Show resolved Hide resolved
if got, want := res.StatusCode, 304; got != want {
t.Fatalf("res.StatusCode: got %d, want %d", got, want)
}
if _, err := conn.Read(make([]byte, 0)); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's read at least a byte.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no byte, it would block, changing to nil.

@mmatczuk
Copy link
Contributor Author

Fixed implementations renamed some functions

…n extraction

The std http package returns the underlying connection in body of 101 response. The response body needs to be removed form the response.
Make reads from the replaced body panic to ensure that it's always handled correctly.
@mmatczuk mmatczuk merged commit 4d0dc65 into main Nov 21, 2024
6 checks passed
@mmatczuk mmatczuk deleted the mmt/304_hardening branch November 21, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants