提交 18963ee9 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-13625]

In the end, proper fix requires having a filter that tracks
GZipOutputStream.
上级 ecec5902
......@@ -42,7 +42,7 @@ THE SOFTWARE.
<properties>
<staplerFork>true</staplerFork>
<stapler.version>1.188</stapler.version>
<stapler.version>1.189</stapler.version>
</properties>
<dependencies>
......
......@@ -82,16 +82,7 @@ public class HudsonAuthenticationEntryPoint extends AuthenticationProcessingFilt
rsp.setContentType("text/html;charset=UTF-8");
PrintWriter out;
try {
OutputStream sout = rsp.getOutputStream();
// if (rsp.containsHeader("Content-Encoding")) {
// // we serve Jelly pages with Content-Encoding:gzip.
// // ServletResponse doesn't provide means for us to check the value of the header,
// // to make the matter worse, GZIPOutputStream writes a header right away,
// // so by the time we get here we already have GZip header. Skip that part away by skipping first 10 bytes.
// // this is a hack.
// sout = new GZIPOutputStream(new ChopHeaderOutputStream(sout,10));
// }
out = new PrintWriter(new OutputStreamWriter(sout));
out = new PrintWriter(new OutputStreamWriter(rsp.getOutputStream()));
} catch (IllegalStateException e) {
out = rsp.getWriter();
}
......@@ -110,32 +101,4 @@ public class HudsonAuthenticationEntryPoint extends AuthenticationProcessingFilt
out.close();
}
}
private static class ChopHeaderOutputStream extends FilterOutputStream {
private int count;
ChopHeaderOutputStream(OutputStream out, int count) {
super(out);
this.count = count;
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
int i = Math.min(len,count);
count-=i;
off+=i;
len-=i;
if (len>0)
out.write(b, off, len);
}
@Override
public void write(int b) throws IOException {
if (count>0)
count--;
else
out.write(b);
}
}
}
......@@ -2997,6 +2997,13 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
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);
}
......
......@@ -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>
......@@ -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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册