handle "Transfer-Encoding: chunked" header properly when LFS server asks us to send it#86
Merged
Conversation
ff5301c to
1f3883d
Compare
…sks us to send it
Before this commit, we would die when talking to GitLab >= 13.7:
org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at ru.bozaro.gitlfs.client.internal.HttpClientExecutor.executeMethod(HttpClientExecutor.java:27)
at ru.bozaro.gitlfs.client.Client.doRequest(Client.java:117)
at ru.bozaro.gitlfs.client.Client.putObject(Client.java:215)
Caused by:
org.apache.http.ProtocolException: Transfer-encoding header already present
at org.apache.http.protocol.RequestContent.process(RequestContent.java:94)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:133)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
... 9 more
This is caused by https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48269.
Since that change, GitLab adds "Transfer-Encoding: chunked" HTTP header to LFS URL and we attempt to blindly add it to our response.
Unfortunately, org.apache.http.protocol.RequestContent.process doesn't like when someone except it sets
"Transfer-Encoding" HTTP header.
Thus, this commit adds custom handling for "Transfer-Encoding" HTTP header and delegates it to AbstractHttpEntity.setChunked
1f3883d to
bedce91
Compare
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.
Before this commit, we would die when talking to GitLab >= 13.7:
This is caused by https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48269.
Since that change, GitLab adds "Transfer-Encoding: chunked" HTTP header to LFS URL and we attempt to blindly add it to our response.
Unfortunately, org.apache.http.protocol.RequestContent.process doesn't like when someone except it sets
"Transfer-Encoding" HTTP header.
Thus, this commit adds custom handling for "Transfer-Encoding" HTTP header and delegates it to AbstractHttpEntity.setChunked
Fixes git-as-svn/git-as-svn#365