Skip to content

Commit 6838ffa

Browse files
committed
copy
1 parent 424ce21 commit 6838ffa

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/main/java/io/fusionauth/http/server/Configurable.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,13 @@ default T withMaxPendingSocketConnections(int maxPendingSocketConnections) {
186186
}
187187

188188
/**
189-
* Sets the maximum size of the HTTP request body by optionally per Content-Type. If this limit is exceeded, the connection will be closed.
189+
* Sets the maximum size of the HTTP request body by Content-Type. If this limit is exceeded, the connection will be closed.
190190
* <p>
191-
* A key of "*" will be the default value if a key doesn't exist for the specific Content-Type. Additionally, you can specify wildcards
192-
* for subtypes of Content-Types such as "application/*". This will be used if the exact Content-Type key is not in the Map.
191+
* The default size is identified by the "*" key. This default value will be used if a more specific value has not been configured for the
192+
* requested Content-Type.
193+
* <p>
194+
* You may also use wildcards to match one to many subtypes. For example, "application/*" will provide a max size for all content types
195+
* beginning with application/ when an exact match has not been configured.
193196
* <p>
194197
* An example lookup for the Content-Type "application/x-www-form-urlencoded" is:
195198
* <ol>
@@ -198,13 +201,13 @@ default T withMaxPendingSocketConnections(int maxPendingSocketConnections) {
198201
* <li>*</li>
199202
* </ol>
200203
* <p>
201-
* If you pass in a Map that does not contain a default size using the String "*", this will retain the default value set by java-http.
202-
* Similarly, the default value for "application/x-www-form-urlencoded" is also retained if the Mapp you provide does not contain that
204+
* If the provided configuration does not contain the initial default values for "*" and "application/x-www-form-urlencoded", the
205+
* server default values will be retained.
203206
* key.
204207
* <p>
205208
* Set any value to -1 to disable this limitation.
206209
* <p>
207-
* Defaults to 128 Megabytes for the wildcard "*" and 10 Megabytes for "application/x-www-form-urlencoded".
210+
* Defaults to 128 Megabytes for the default "*" and 10 Megabytes for "application/x-www-form-urlencoded".
208211
*
209212
* @param maxRequestBodySize a map specifying the maximum size in bytes for the HTTP request body by Content-Type
210213
* @return This.

src/main/java/io/fusionauth/http/server/HTTPServerConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
* @author Brian Pontarelli
3434
*/
3535
public class HTTPServerConfiguration implements Configurable<HTTPServerConfiguration> {
36-
public static final Map<String, Integer> DefaultMaxSizes = Map.of(
36+
public static final Map<String, Integer> DefaultMaxRequestSizes = Map.of(
3737
"*", 128 * 1024 * 1024, // 128 Megabytes
3838
"application/x-www-form-urlencoded", 10 * 1024 * 1024 // 10 Megabytes
3939
);
4040

4141
private final List<HTTPListenerConfiguration> listeners = new ArrayList<>();
4242

43-
private final Map<String, Integer> maxRequestBodySize = new HashMap<>(DefaultMaxSizes);
43+
private final Map<String, Integer> maxRequestBodySize = new HashMap<>(DefaultMaxRequestSizes);
4444

4545
private Path baseDir = Path.of("");
4646

@@ -492,7 +492,7 @@ public HTTPServerConfiguration withMaxRequestBodySize(Map<String, Integer> maxRe
492492

493493
// This preserves the default values in the field definition if the incoming Map does not contain them. Otherwise, they are overridden
494494
this.maxRequestBodySize.clear();
495-
this.maxRequestBodySize.putAll(DefaultMaxSizes);
495+
this.maxRequestBodySize.putAll(DefaultMaxRequestSizes);
496496
this.maxRequestBodySize.putAll(maxRequestBodySize);
497497
return this;
498498
}

0 commit comments

Comments
 (0)