Skip to content

Commit 224e374

Browse files
erikjogiErik Jõgi, Andrei Solntsev
authored andcommitted
Allow to limit the size of whole request or the size of one uploaded file in a request.
The configuration parameters are: 'upload.sizeMax' and 'upload.fileSizeMax'. The defaults stay the same -1 which means 'unlimited'.
1 parent faf0972 commit 224e374

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

documentation/manual/configuration.textile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,21 @@ bc. upload.threshold=20480
11651165

11661166
Default: @10240@
11671167

1168+
h3(#upload.sizeMax). upload.sizeMax
1169+
1170+
The maximum size permitted for the complete request. A value of -1 indicates no maximum.
1171+
1172+
bc. upload.sizeMax=20480
1173+
1174+
Default: @-1@
1175+
1176+
h3(#upload.fileSizeMax). upload.fileSizeMax
1177+
1178+
The maximum size permitted for a single uploaded file, as opposed to. A value of -1 indicates no maximum.
1179+
1180+
bc. upload.fileSizeMax=1024
1181+
1182+
Default: @-1@
11681183

11691184
h2(#xforwarded). Proxy forwarding
11701185

framework/src/play/data/parsing/ApacheMultipartParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,12 +612,12 @@ public Map<String, String[]> parse(InputStream body) {
612612
* The maximum size permitted for the complete request, as opposed to
613613
* {@link #fileSizeMax}. A value of -1 indicates no maximum.
614614
*/
615-
private long sizeMax = -1;
615+
private long sizeMax = Integer.parseInt(Play.configuration.getProperty("upload.sizeMax", "-1"));
616616
/**
617617
* The maximum size permitted for a single uploaded file, as opposed to
618618
* {@link #sizeMax}. A value of -1 indicates no maximum.
619619
*/
620-
private long fileSizeMax = -1;
620+
private long fileSizeMax = Integer.parseInt(Play.configuration.getProperty("upload.fileSizeMax", "-1"));
621621

622622
// ------------------------------------------------------ Protected methods
623623

0 commit comments

Comments
 (0)