Skip to content

Commit fae9e3e

Browse files
committed
[UNDERTOW-2476]-Create a default constant for UndertowOptions.ALLOW_UNKNOWN_PROTOCOLS
1 parent 65d8b1f commit fae9e3e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

core/src/main/java/io/undertow/UndertowOptions.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ public class UndertowOptions {
262262
@Deprecated(forRemoval = true)
263263
public static final Option<Boolean> ENABLE_CONNECTOR_STATISTICS = ENABLE_STATISTICS;
264264

265+
/**
266+
* Default value of {@link #ALLOW_UNKNOWN_PROTOCOLS} option.
267+
*/
268+
public static final Boolean DEFAULT_ALLOW_UNKNOWN_PROTOCOLS = false;
265269

266270
/**
267271
* If unknown protocols should be allowed. The known protocols are:
@@ -272,8 +276,8 @@ public class UndertowOptions {
272276
* HTTP/2.0
273277
*
274278
* If this is false then requests that specify any other protocol will be rejected with a 400
275-
*
276-
* Defaults to false
279+
* <p>
280+
* Defaults to {@link #DEFAULT_ALLOW_UNKNOWN_PROTOCOLS}
277281
*/
278282
public static final Option<Boolean> ALLOW_UNKNOWN_PROTOCOLS = Option.simple(UndertowOptions.class, "ALLOW_UNKNOWN_PROTOCOLS", Boolean.class);
279283

core/src/main/java/io/undertow/server/protocol/http/HttpReadListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ final class HttpReadListener implements ChannelListener<ConduitStreamSourceChann
9999
this.maxEntitySize = connection.getUndertowOptions().get(UndertowOptions.MAX_ENTITY_SIZE, UndertowOptions.DEFAULT_MAX_ENTITY_SIZE);
100100
this.recordRequestStartTime = connection.getUndertowOptions().get(UndertowOptions.RECORD_REQUEST_START_TIME, false);
101101
this.requireHostHeader = connection.getUndertowOptions().get(UndertowOptions.REQUIRE_HOST_HTTP11, true);
102-
this.allowUnknownProtocols = connection.getUndertowOptions().get(UndertowOptions.ALLOW_UNKNOWN_PROTOCOLS, false);
102+
this.allowUnknownProtocols = connection.getUndertowOptions().get(UndertowOptions.ALLOW_UNKNOWN_PROTOCOLS, UndertowOptions.DEFAULT_ALLOW_UNKNOWN_PROTOCOLS);
103103
int requestParseTimeout = connection.getUndertowOptions().get(UndertowOptions.REQUEST_PARSE_TIMEOUT, -1);
104104
int requestIdleTimeout = connection.getUndertowOptions().get(UndertowOptions.NO_REQUEST_TIMEOUT, -1);
105105
if(requestIdleTimeout < 0 && requestParseTimeout < 0) {

0 commit comments

Comments
 (0)