Skip to content

Commit

Permalink
[FIXED JENKINS-25212]
Browse files Browse the repository at this point in the history
Fixing this problem in this plugin by not allowing jgit to compress the response. This can be removed once we can depend on the core that has Stapler 1.234.
  • Loading branch information
kohsuke committed Dec 18, 2014
1 parent b211dff commit 12842a7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Expand Up @@ -140,6 +140,8 @@ public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
if (realRequest==null)
realRequest = req;

realRequest = new Jenkins2521Workaround(realRequest);

/*
GitServlet uses getPathInfo() to determine the current request, whereas in Stapler's sense it should be using
getRestOfPath().
Expand Down
@@ -0,0 +1,28 @@
package org.jenkinsci.plugins.gitserver;

import org.kohsuke.stapler.compression.CompressionFilter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

/**
* Work around JENKINS-25212 until we can depend on core that has Stapler 1.234.
*
* By hiding "Accept-Encoding" request header, jgit will not attempt to do its own compression,
* which triggers setHeader("Content-Encoding","gzip") that triggers {@link CompressionFilter}
* incorrectly.
*
* @author Kohsuke Kawaguchi
*/
class Jenkins2521Workaround extends HttpServletRequestWrapper {
Jenkins2521Workaround(HttpServletRequest req) {
super(req);
}

@Override
public String getHeader(String name) {
if (name.equals("Accept-Encoding"))
return null;
return super.getHeader(name);
}
}

0 comments on commit 12842a7

Please sign in to comment.