This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new a4d6ffb66f Deprecate allowHostHeaderMismatch and rejectIllegalHeader
a4d6ffb66f is described below
commit a4d6ffb66f34f7d1da789179d20cc327c6c51fcc
Author: Mark Thomas <[email protected]>
AuthorDate: Tue May 2 17:15:21 2023 +0100
Deprecate allowHostHeaderMismatch and rejectIllegalHeader
---
.../coyote/http11/AbstractHttp11Protocol.java | 26 +++++++++++++++++-----
java/org/apache/coyote/http11/Http11Processor.java | 2 ++
webapps/docs/changelog.xml | 5 +++++
webapps/docs/config/http.xml | 10 +++++++--
4 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
b/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
index a8fab9554d..b2679d7618 100644
--- a/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
+++ b/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
@@ -59,7 +59,7 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
private final CompressionConfig compressionConfig = new
CompressionConfig();
- public AbstractHttp11Protocol(AbstractEndpoint<S, ?> endpoint) {
+ public AbstractHttp11Protocol(AbstractEndpoint<S,?> endpoint) {
super(endpoint);
setConnectionTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
}
@@ -115,7 +115,7 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
* Over-ridden here to make the method visible to nested classes.
*/
@Override
- protected AbstractEndpoint<S, ?> getEndpoint() {
+ protected AbstractEndpoint<S,?> getEndpoint() {
return super.getEndpoint();
}
@@ -178,7 +178,11 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
* the request line?
*
* @return {@code true} if Tomcat will allow such requests, otherwise
{@code false}
+ *
+ * @deprecated This will removed in Tomcat 11 onwards where {@code
allowHostHeaderMismatch} will be hard-coded to
+ * {@code false}.
*/
+ @Deprecated
public boolean getAllowHostHeaderMismatch() {
return allowHostHeaderMismatch;
}
@@ -188,7 +192,11 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
* the request line?
*
* @param allowHostHeaderMismatch {@code true} to allow such requests,
{@code false} to reject them with a 400
+ *
+ * @deprecated This will removed in Tomcat 11 onwards where {@code
allowHostHeaderMismatch} will be hard-coded to
+ * {@code false}.
*/
+ @Deprecated
public void setAllowHostHeaderMismatch(boolean allowHostHeaderMismatch) {
this.allowHostHeaderMismatch = allowHostHeaderMismatch;
}
@@ -201,7 +209,11 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
* token) will the request be rejected (with a 400 response) or will the
illegal header be ignored?
*
* @return {@code true} if the request will be rejected or {@code false}
if the header will be ignored
+ *
+ * @deprecated This will removed in Tomcat 11 onwards where {@code
allowHostHeaderMismatch} will be hard-coded to
+ * {@code true}.
*/
+ @Deprecated
public boolean getRejectIllegalHeader() {
return rejectIllegalHeader;
}
@@ -212,7 +224,11 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
*
* @param rejectIllegalHeader {@code true} to reject requests with illegal
header names or values, {@code false} to
* ignore the header
+ *
+ * @deprecated This will removed in Tomcat 11 onwards where {@code
allowHostHeaderMismatch} will be hard-coded to
+ * {@code true}.
*/
+ @Deprecated
public void setRejectIllegalHeader(boolean rejectIllegalHeader) {
this.rejectIllegalHeader = rejectIllegalHeader;
}
@@ -577,11 +593,11 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
/**
* The protocols that are available via internal Tomcat support for access
via HTTP upgrade.
*/
- private final Map<String, UpgradeProtocol> httpUpgradeProtocols = new
HashMap<>();
+ private final Map<String,UpgradeProtocol> httpUpgradeProtocols = new
HashMap<>();
/**
* The protocols that are available via internal Tomcat support for access
via ALPN negotiation.
*/
- private final Map<String, UpgradeProtocol> negotiatedProtocols = new
HashMap<>();
+ private final Map<String,UpgradeProtocol> negotiatedProtocols = new
HashMap<>();
private void configureUpgradeProtocol(UpgradeProtocol upgradeProtocol) {
// HTTP Upgrade
@@ -633,7 +649,7 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
* To enable basic statistics to be made available for these protocols, a
map of protocol name to
* {@link UpgradeGroupInfo} instances is maintained here.
*/
- private final Map<String, UpgradeGroupInfo> upgradeProtocolGroupInfos =
new ConcurrentHashMap<>();
+ private final Map<String,UpgradeGroupInfo> upgradeProtocolGroupInfos = new
ConcurrentHashMap<>();
public UpgradeGroupInfo getUpgradeGroupInfo(String upgradeProtocol) {
if (upgradeProtocol == null) {
diff --git a/java/org/apache/coyote/http11/Http11Processor.java
b/java/org/apache/coyote/http11/Http11Processor.java
index 67d1452de4..db2286d2b0 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -149,6 +149,7 @@ public class Http11Processor extends AbstractProcessor {
private SendfileDataBase sendfileData = null;
+ @SuppressWarnings("deprecation")
public Http11Processor(AbstractHttp11Protocol<?> protocol, Adapter
adapter) {
super(adapter);
this.protocol = protocol;
@@ -622,6 +623,7 @@ public class Http11Processor extends AbstractProcessor {
/**
* After reading the request headers, we have to setup the request filters.
*/
+ @SuppressWarnings("deprecation")
private void prepareRequest() throws IOException {
if (protocol.isSSLEnabled()) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0085bfa614..71f12e1eea 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -146,6 +146,11 @@
Fix an edge case in HTTP header parsing and ensure that HTTP headers
without names are treated as invalid. (markt)
</fix>
+ <update>
+ Deprecate the HTTP Connector settings <code>rejectIllegalHeader</code>
+ and <code>allowHostHeaderMismatch</code> as they have been removed in
+ Tomcat 11 onwards. (markt)
+ </update>
</changelog>
</subsection>
<subsection name="Jasper">
diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml
index a76bee3edb..6dcc4bb9f4 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -344,7 +344,10 @@
<p>By default Tomcat will reject requests that specify a host in the
request line but specify a different host in the host header. This
check can be disabled by setting this attribute to <code>true</code>. If
- not specified, the default is <code>false</code>.</p>
+ not specified, the default is <code>false</code>.
+ <br/>
+ This setting will be removed in Tomcat 11 onwards where it will be
+ hard-coded to <code>false</code>.</p>
</attribute>
<attribute name="allowedTrailerHeaders" required="false">
@@ -618,7 +621,10 @@
value (e.g. the header name is not a token) this setting determines if
the
request will be rejected with a 400 response (<code>true</code>) or if
the
illegal header be ignored (<code>false</code>). The default value is
- <code>true</code> which will cause the request to be rejected.</p>
+ <code>true</code> which will cause the request to be rejected.
+ <br/>
+ This setting will be removed in Tomcat 11 onwards where it will be
+ hard-coded to <code>true</code>.</p>
</attribute>
<attribute name="relaxedPathChars" required="false">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]