Skip to content

handle "Transfer-Encoding: chunked" header properly when LFS server asks us to send it#86

Merged
slonopotamus merged 1 commit into
git-as-svn:masterfrom
slonopotamus:chunked-transfer
Jan 30, 2021
Merged

handle "Transfer-Encoding: chunked" header properly when LFS server asks us to send it#86
slonopotamus merged 1 commit into
git-as-svn:masterfrom
slonopotamus:chunked-transfer

Conversation

@slonopotamus

@slonopotamus slonopotamus commented Jan 29, 2021

Copy link
Copy Markdown
Collaborator

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

Fixes git-as-svn/git-as-svn#365

…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
@slonopotamus slonopotamus merged commit a2df66e into git-as-svn:master Jan 30, 2021
@slonopotamus slonopotamus deleted the chunked-transfer branch January 30, 2021 13:53
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.

GitLabIntegrationTest.testLfs fails with GitLab 13.7+

1 participant