-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
28 changes: 28 additions & 0 deletions
28
src/main/java/org/jenkinsci/plugins/gitserver/Jenkins2521Workaround.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |