Permalink
Browse files

[#1618] Log an error in case te request exceeds 8192 bytes

  • Loading branch information...
1 parent d3f2984 commit 98ef1dd9cbe87d82e55f96287103201462999e22 Igmar Palsenberg committed with Notalifeform Feb 1, 2013
Showing with 7 additions and 0 deletions.
  1. +7 −0 framework/src/play/server/PlayHandler.java
@@ -6,6 +6,7 @@
import org.jboss.netty.buffer.ChannelBufferInputStream;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.*;
+import org.jboss.netty.handler.codec.frame.TooLongFrameException;
import org.jboss.netty.handler.codec.http.*;
import org.jboss.netty.handler.codec.http.websocketx.*;
import org.jboss.netty.handler.stream.ChunkedFile;
@@ -628,6 +629,12 @@ public Request parseRequest(ChannelHandlerContext ctx, HttpRequest nettyRequest,
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
try {
+ // If we get a TooLongFrameException, we got a request exceeding 8k.
+ // Log this, we can't call serve500()
+ Throwable t = e.getCause();
+ if (t instanceof TooLongFrameException) {
+ Logger.error("Request exceeds 8192 bytes");
+ }
e.getChannel().close();
} catch (Exception ex) {
}

4 comments on commit 98ef1dd

@PeteyPabPro

The total request size is over 8192, or just the header?

@PeteyPabPro

Thanks.. But the max request header size can be configured with http.netty.maxHeaderSize, correct? So it wouldn't necessarily be 8192?

@Notalifeform
Contributor
Please sign in to comment.