-
Notifications
You must be signed in to change notification settings - Fork 451
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
HttpContent is encoded two times when posting data #648
Comments
This is a duplicate of #283. |
It turns out this is non-trivial to fix. The issue is that for some transport adapters, we have to set the Content-Length header before we start streaming the content. This means that we must count the bytes before we send them. We don't want to cache the encoded content in memory as it defeats the purpose of streaming the content and could cause memory spikes in the application. We don't want to write to a temporary file as there may be file system issues/restrictions (like on GAE) that we cannot necessarily plan for. |
@chingor13 do we have more details on this one? Such as what is being affected? Or is there a finite list of Transport Adapters that need the |
I will take a stab at this. |
Currently any time HttpRequest works with encoded data it encodes the data twice. Once for the actaul stream and once for checking the length of the stream. Instead, when there is encoding just don't set the content length. This will cause the underlying transports, with a few tweaks, to use Transfer-Encoding: chunked. Fixes googleapis#648
Currently any time HttpRequest works with encoded data it encodes the data twice. Once for the actual stream and once for checking the length of the stream. Instead, when there is encoding just don't set the content length. This will cause the underlying transports, with a few tweaks, to use Transfer-Encoding: chunked. Fixes #648
The resulting request is correctly encoded once, but we are encoding an extra time when we calculate the content length.
The text was updated successfully, but these errors were encountered: