fix: use reader over readcloser, regen cookie-jar#11482
Merged
powersj merged 1 commit intoinfluxdata:masterfrom Jul 18, 2022
Merged
fix: use reader over readcloser, regen cookie-jar#11482powersj merged 1 commit intoinfluxdata:masterfrom
powersj merged 1 commit intoinfluxdata:masterfrom
Conversation
Similar to influxdata#11083, some HTTP servers seem to quietly requires the content-length header in messages sent. Use of Go's ReadCloser does not allow for the content-length to be sent. As this is for a simple login the body length will be very small and the more efficient processing of a closer is not required in this use case. Moves the creation of the cookie jar as well. On a re-auth, the cookie was included in the request. Not only does this not make sense it can cause issues on some APIs where this was not expected. Given the original request does not contain this it seems safe to remake the cookie jar, emptying it, for each auth request. This also adds the ability to see the response body in the event of an error to gain a bit more details. fixes: influxdata#11478
Contributor
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 👍 This pull request doesn't change the Telegraf binary size 📦 Click here to get additional PR build artifactsArtifact URLs |
MyaLongmire
pushed a commit
that referenced
this pull request
Jul 25, 2022
(cherry picked from commit b507636)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: use reader over readcloser, regen cookie-jar
Similar to #11083, some HTTP servers seem to quietly requires the
content-length header in messages sent. Use of Go's ReadCloser does not
allow for the content-length to be sent. As this is for a simple login
the body length will be very small and the more efficient processing of
a closer is not required in this use case.
Moves the creation of the cookie jar as well. On a re-auth, the cookie
was included in the request. Not only does this not make sense it can
cause issues on some APIs where this was not expected. Given the
original request does not contain this it seems safe to remake the
cookie jar, emptying it, for each auth request.
This also adds the ability to see the response body in the event of an
error to gain a bit more details.
fixes: #11478