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

Skip content length when it is not available in headers #1719

Merged
merged 3 commits into from
Jun 18, 2021

Conversation

linzhp
Copy link
Contributor

@linzhp linzhp commented Jun 18, 2021

What is the problem I am trying to address?

In some cases, Amazon S3 may not always return a Content-Length header. In this case, the size will not be set and take the zero value, and http.ResponseWriter will complain:

http: wrote more than the declared Content-Length

The data will be ignored

How is the fix applied?

Skip Content-Length in response when the size is 0, so at least the data can be sent.

@linzhp linzhp requested a review from a team as a code owner June 18, 2021 12:43
Copy link
Contributor

@marwan-at-work marwan-at-work left a comment

Choose a reason for hiding this comment

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

Thank you for the fix! Just a quick comment and should be good.

pkg/download/version_zip.go Outdated Show resolved Hide resolved
pkg/storage/s3/getter.go Outdated Show resolved Hide resolved
Copy link
Contributor

@marwan-at-work marwan-at-work left a comment

Choose a reason for hiding this comment

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

🙌🏼

@marwan-at-work marwan-at-work merged commit 9b505e9 into gomods:main Jun 18, 2021
@linzhp linzhp changed the title Use actual content length when it is not available in headers Skip content length when it is not available in headers Jun 19, 2021
@linzhp linzhp deleted the content-len branch June 24, 2021 07:24
linzhp added a commit to linzhp/athens that referenced this pull request Aug 26, 2022
Summary: To pick up [[ gomods#1719 | gomods#1719 ]] and prepare for swithcing to S3 backend

Test Plan: This will only be deployed after switching to S3

Reviewers: tanx

JIRA Issues: GM-673

Differential Revision: https://code.uberinternal.com/D6215203
linzhp added a commit to linzhp/athens that referenced this pull request Aug 26, 2022
Summary: To pick up [[ gomods#1719 | gomods#1719 ]] and prepare for switching to S3 backend

Test Plan: This will only be deployed after switching to S3

Reviewers: tanx

Reviewed By: tanx

JIRA Issues: GM-673

Differential Revision: https://code.uberinternal.com/D6215203
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.

2 participants