Skip to content

Do not close HTTP request body in HTTP handler#4067

Merged
milosgajdos merged 1 commit intodistribution:mainfrom
milosgajdos:dont-close-request-body
Sep 23, 2023
Merged

Do not close HTTP request body in HTTP handler#4067
milosgajdos merged 1 commit intodistribution:mainfrom
milosgajdos:dont-close-request-body

Conversation

@milosgajdos
Copy link
Member

Closes #4065

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

SGTM, but could use extra eyes as this always confuses me ☺️

@milosgajdos milosgajdos requested a review from corhere September 22, 2023 16:41
Copy link
Collaborator

@corhere corhere left a comment

Choose a reason for hiding this comment

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

The Go 1.21 go doc says:

	// Body is the request's body.
	//
	// [...]
	//
	// For server requests, the Request Body is always non-nil
	// but will return EOF immediately when no body is present.
	// The Server will close the request body. The ServeHTTP
	// Handler does not need to.

LGTM!

@rogpeppe
Copy link

Thanks for this!

@milosgajdos milosgajdos merged commit 5e6af2f into distribution:main Sep 23, 2023
@milosgajdos milosgajdos deleted the dont-close-request-body branch September 23, 2023 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

registry/handlers: ServeHTTP method should not close request body

6 participants