Skip to content

Commit

Permalink
[FIXED JENKINS-13625]
Browse files Browse the repository at this point in the history
In the end, proper fix requires having a filter that tracks
GZipOutputStream.
(cherry picked from commit 18963ee)

Conflicts:

	core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java
  • Loading branch information
kohsuke authored and vjuranek committed Jul 8, 2012
1 parent 6b495ce commit 47bb6d8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/pom.xml
Expand Up @@ -42,7 +42,7 @@ THE SOFTWARE.

<properties>
<staplerFork>true</staplerFork>
<stapler.version>1.188</stapler.version>
<stapler.version>1.189</stapler.version>
</properties>

<dependencies>
Expand Down
Expand Up @@ -78,8 +78,7 @@ public void commence(ServletRequest request, ServletResponse response, Authentic
rsp.setContentType("text/html;charset=UTF-8");
PrintWriter out;
try {
ServletOutputStream sout = rsp.getOutputStream();
out = new PrintWriter(new OutputStreamWriter(sout));
out = new PrintWriter(new OutputStreamWriter(rsp.getOutputStream()));
} catch (IllegalStateException e) {
out = rsp.getWriter();
}
Expand All @@ -95,7 +94,7 @@ public void commence(ServletRequest request, ServletResponse response, Authentic
// See http://support.microsoft.com/kb/294807
for (int i=0; i < 10; i++)
out.print(" ");
out.flush();
out.close();
}
}
}
7 changes: 7 additions & 0 deletions core/src/main/java/jenkins/model/Jenkins.java
Expand Up @@ -2972,6 +2972,13 @@ public void doGc(StaplerResponse rsp) throws IOException {
rsp.getWriter().println("GCed");
}

/**
* End point that intentionally throws an exception to test the error behaviour.
*/
public void doException() {
throw new RuntimeException();
}

public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws IOException, JellyException {
return new ContextMenu().from(this,request,response);
}
Expand Down
8 changes: 8 additions & 0 deletions war/src/main/webapp/WEB-INF/web.xml
Expand Up @@ -48,6 +48,10 @@ THE SOFTWARE.
<filter-name>encoding-filter</filter-name>
<filter-class>hudson.util.CharacterEncodingFilter</filter-class>
</filter>
<filter>
<filter-name>compression-filter</filter-name>
<filter-class>org.kohsuke.stapler.compression.CompressionFilter</filter-class>
</filter>
<filter>
<filter-name>authentication-filter</filter-name>
<filter-class>hudson.security.HudsonFilter</filter-class>
Expand Down Expand Up @@ -110,6 +114,10 @@ THE SOFTWARE.
<filter-name>encoding-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>compression-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>authentication-filter</filter-name>
<url-pattern>/*</url-pattern>
Expand Down

0 comments on commit 47bb6d8

Please sign in to comment.