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

http: ReponseWriter prefer ReadFrom if available #6565

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

WeidiDeng
Copy link
Member

Fix 6546.

@mholt mholt added the bug 🐞 Something isn't working label Oct 1, 2024
@mholt mholt added this to the v2.9.0 milestone Oct 1, 2024
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Thanks Weidi -- I am still not 100% sure why this is needed since I thought io.Copy does this, but if you are sure it works, let's go ahead and merge it. 🙂

@mholt mholt merged commit f3aead0 into master Oct 1, 2024
33 checks passed
@mholt mholt deleted the responsewriter-readfrom branch October 1, 2024 17:19
@WeidiDeng
Copy link
Member Author

io.Copy prefers io.WriterTo which *os.File implements. *os.File will later use io.ReaderFrom with a wrapper file, the wrapped file isn't recognized as a valid target for sendfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cannot use sendfile() in a http handler:
2 participants