Skip to content

Commit

Permalink
Merge pull request #1515 from ropalka/default-constants
Browse files Browse the repository at this point in the history
[UNDERTOw-2310][UNDERTOW-2311] Introducing Missing Default Constants
  • Loading branch information
fl4via committed Oct 12, 2023
2 parents da1b0a4 + e90fbbf commit ef2c80b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion core/src/main/java/io/undertow/UndertowOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public class UndertowOptions {
public static final Option<Integer> MAX_HEADERS = Option.simple(UndertowOptions.class, "MAX_HEADERS", Integer.class);


public static final int DEFAULT_MAX_COOKIES = 200;

/**
* The maximum number of cookies that will be parsed. This is used to protect against hash vulnerabilities.
* <p>
Expand Down Expand Up @@ -265,7 +267,7 @@ public class UndertowOptions {
public static final Option<Boolean> HTTP2_SETTINGS_ENABLE_PUSH = Option.simple(UndertowOptions.class, "HTTP2_SETTINGS_ENABLE_PUSH", Boolean.class);

/**
* The maximum number of concurrent
* The maximum number of concurrent http2 streams.
*/
public static final Option<Integer> HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = Option.simple(UndertowOptions.class, "HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS", Integer.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ public class Http2Channel extends AbstractFramedChannel<Http2Channel, AbstractHt

public static final int DEFAULT_INITIAL_WINDOW_SIZE = 65535;

public static final int DEFAULT_MAX_CONCURRENT_STREAMS = -1;

static final byte[] PREFACE_BYTES = {
0x50, 0x52, 0x49, 0x20, 0x2a, 0x20, 0x48, 0x54,
0x54, 0x50, 0x2f, 0x32, 0x2e, 0x30, 0x0d, 0x0a,
Expand Down Expand Up @@ -214,7 +216,7 @@ public Http2Channel(StreamConnection connectedStreamChannel, String protocol, By
pushEnabled = settings.get(UndertowOptions.HTTP2_SETTINGS_ENABLE_PUSH, true);
this.initialReceiveWindowSize = settings.get(UndertowOptions.HTTP2_SETTINGS_INITIAL_WINDOW_SIZE, DEFAULT_INITIAL_WINDOW_SIZE);
this.receiveWindowSize = initialReceiveWindowSize;
this.receiveMaxConcurrentStreams = settings.get(UndertowOptions.HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, -1);
this.receiveMaxConcurrentStreams = settings.get(UndertowOptions.HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, DEFAULT_MAX_CONCURRENT_STREAMS);

this.protocol = protocol == null ? Http2OpenListener.HTTP2 : protocol;
this.maxHeaders = settings.get(UndertowOptions.MAX_HEADERS, clientSide ? -1 : UndertowOptions.DEFAULT_MAX_HEADERS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ public Iterable<Cookie> requestCookies() {
Set<Cookie> requestCookiesParam = new OverridableTreeSet<>();
requestCookies = new DelegatingIterable<>(requestCookiesParam);
Cookies.parseRequestCookies(
getConnection().getUndertowOptions().get(UndertowOptions.MAX_COOKIES, 200),
getConnection().getUndertowOptions().get(UndertowOptions.MAX_COOKIES, UndertowOptions.DEFAULT_MAX_COOKIES),
getConnection().getUndertowOptions().get(UndertowOptions.ALLOW_EQUALS_IN_COOKIE_VALUE, false),
requestHeaders.get(Headers.COOKIE), requestCookiesParam);
}
Expand Down

0 comments on commit ef2c80b

Please sign in to comment.