You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/01/20 19:04:52 UTC
[tomcat] 03/12: Send setting to disable RFC 7540 settings by default
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit a68294971e894aa81e172cceb6fb35410d6984f4
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Dec 6 18:05:38 2022 +0000
Send setting to disable RFC 7540 settings by default
---
java/org/apache/coyote/http2/ConnectionSettingsBase.java | 16 ++++++++++++++++
java/org/apache/coyote/http2/LocalStrings.properties | 1 +
2 files changed, 17 insertions(+)
diff --git a/java/org/apache/coyote/http2/ConnectionSettingsBase.java b/java/org/apache/coyote/http2/ConnectionSettingsBase.java
index ef4a20010a..bd880f669f 100644
--- a/java/org/apache/coyote/http2/ConnectionSettingsBase.java
+++ b/java/org/apache/coyote/http2/ConnectionSettingsBase.java
@@ -45,6 +45,9 @@ abstract class ConnectionSettingsBase<T extends Throwable> {
static final int DEFAULT_MAX_FRAME_SIZE = MIN_MAX_FRAME_SIZE;
static final long DEFAULT_MAX_HEADER_LIST_SIZE = 1 << 15;
+ // Defaults (defined by Tomcat)
+ static final long DEFAULT_NO_RFC7540_PRIORITIES = 1;
+
Map<Setting, Long> current = new ConcurrentHashMap<>();
Map<Setting, Long> pending = new ConcurrentHashMap<>();
@@ -58,6 +61,7 @@ abstract class ConnectionSettingsBase<T extends Throwable> {
current.put(Setting.INITIAL_WINDOW_SIZE, Long.valueOf(DEFAULT_INITIAL_WINDOW_SIZE));
current.put(Setting.MAX_FRAME_SIZE, Long.valueOf(DEFAULT_MAX_FRAME_SIZE));
current.put(Setting.MAX_HEADER_LIST_SIZE, Long.valueOf(DEFAULT_MAX_HEADER_LIST_SIZE));
+ current.put(Setting.NO_RFC7540_PRIORITIES, Long.valueOf(DEFAULT_NO_RFC7540_PRIORITIES));
}
@@ -86,6 +90,9 @@ abstract class ConnectionSettingsBase<T extends Throwable> {
case MAX_HEADER_LIST_SIZE:
// No further validation required
break;
+ case NO_RFC7540_PRIORITIES:
+ validateNoRfc7540Priorities(value);
+ break;
case UNKNOWN:
// Unrecognised. Ignore it.
return;
@@ -212,6 +219,15 @@ abstract class ConnectionSettingsBase<T extends Throwable> {
}
+ private void validateNoRfc7540Priorities(long noRfc7540Priorities) throws T {
+ if (noRfc7540Priorities < 0 || noRfc7540Priorities > 1) {
+ String msg = sm.getString("connectionSettings.noRfc7540PrioritiesInvalid",
+ connectionId, Long.toString(noRfc7540Priorities));
+ throwException(msg, Http2Error.PROTOCOL_ERROR);
+ }
+ }
+
+
abstract void throwException(String msg, Http2Error error) throws T;
abstract String getEndpointName();
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties b/java/org/apache/coyote/http2/LocalStrings.properties
index 8972c4fb6e..7587a86f33 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -26,6 +26,7 @@ connectionSettings.debug=Connection [{0}], Endpoint [{1}], Parameter type [{2}]
connectionSettings.enablePushInvalid=Connection [{0}], The requested value for enable push [{1}] is not one of the permitted values (zero or one)
connectionSettings.headerTableSizeLimit=Connection [{0}], Attempted to set a header table size of [{1}] but the limit is 16k
connectionSettings.maxFrameSizeInvalid=Connection [{0}], The requested maximum frame size of [{1}] is outside the permitted range of [{2}] to [{3}]
+connectionSettings.noRfc7540PrioritiesInvalid=Connection [{0}], The requested no RFC 7540 priorities setting [{1}] was not zero or one
connectionSettings.unknown=Connection [{0}], An unknown setting with identifier [{1}] and value [{2}] was ignored
connectionSettings.windowSizeTooBig=Connection [{0}], The requested window size of [{1}] is bigger than the maximum permitted value of [{2}]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org