Skip to content

Commit

Permalink
Doc and made sure we respect the 'unlimited' mode as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
pepite committed Mar 1, 2010
1 parent 63b6c5e commit 2ffc2a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
9 changes: 2 additions & 7 deletions src/play/modules/netty/PlayHandler.java
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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]);
Expand Down
3 changes: 1 addition & 2 deletions src/play/modules/netty/StreamChunkAggregator.java
Expand Up @@ -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(
Expand Down

0 comments on commit 2ffc2a3

Please sign in to comment.