Permalink
Browse files

Doc and made sure we respect the 'unlimited' mode as well.

  • Loading branch information...
pepite committed Mar 1, 2010
1 parent 63b6c5e commit 2ffc2a3fda3aa47f751d2cb9068b5701347cecae
Showing with 3 additions and 9 deletions.
  1. +2 −7 src/play/modules/netty/PlayHandler.java
  2. +1 −2 src/play/modules/netty/StreamChunkAggregator.java
@@ -165,8 +165,6 @@ void saveExceededSizeError(HttpRequest nettyRequest, Response response) {
}
} // Thread
- public static String COOKIE_PREFIX = Play.configuration.getProperty("application.session.cookie", "PLAY");
-
protected static void addToResponse(Response response, HttpResponse nettyResponse) {
Map<String, Http.Header> headers = response.headers;
for (Map.Entry<String, Http.Header> entry : headers.entrySet()) {
@@ -300,11 +298,8 @@ public static Request parseRequest(ChannelHandlerContext ctx, HttpRequest nettyR
if (b instanceof FileChannelBuffer) {
FileChannelBuffer buffer = (FileChannelBuffer) nettyRequest.getContent();
// An error occured
- Integer max = Integer.valueOf(Play.configuration.getProperty("module.netty.maxContentLength", "1048576"));
- if (max == -1) {
- max = Integer.MAX_VALUE;
- }
- if (buffer.getInputStream().available() < max) {
+ Integer max = Integer.valueOf(Play.configuration.getProperty("play.module.netty.maxContentLength", "-1"));
+ if (max == -1 || buffer.getInputStream().available() < max) {
request.body = buffer.getInputStream();
} else {
request.body = new ByteArrayInputStream(new byte[0]);
@@ -93,8 +93,7 @@ public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
// Merge the received chunk into the content of the current message.
final HttpChunk chunk = (HttpChunk) msg;
final File file = new File(Play.tmpDir, name);
-
- if (maxContentLength != -1 && (file.length() > maxContentLength - chunk.getContent().readableBytes())) {
+ if (maxContentLength != -1 && (file.length() > (maxContentLength - chunk.getContent().readableBytes()))) {
currentMessage.setHeader(
HttpHeaders.Names.CONTENT_LENGTH, maxContentLength);
currentMessage.setHeader(

0 comments on commit 2ffc2a3

Please sign in to comment.