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

fix: empty http request body in Connection.Call #171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

childe
Copy link

@childe childe commented Jul 6, 2021

RequestOpts.Body is read out in the first try, and will be empty in the second retry.

RequestOpts.Body is read out in the first try, and will be empty in the
second retry.
Copy link
Owner

@ncw ncw 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 looking at this.

Unfortunately I don't think this will work as written - see inline.

There may be a way to fix it though - more discussion needed

@@ -714,6 +714,11 @@ func (c *Connection) Call(ctx context.Context, targetUrl string, p RequestOpts)
retries = c.Retries
}
var req *http.Request
reqBodyBuf, err := ioutil.ReadAll(p.Body)
Copy link
Owner

Choose a reason for hiding this comment

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

The Body is used to upload objects so could easily be a 5G file which we don't want to buffer in memory.

Where are you seeing this problem?

There are quite a few possible workaround, but to suggest one I need more context.

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