This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new de63b522d9 Deprecate allowHostHeaderMismatch and rejectIllegalHeader
de63b522d9 is described below
commit de63b522d9187c3155b3f1b5d778362105a1360a
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 908ef0f9e3..00e4873cd8 100644
--- a/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
+++ b/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
@@ -57,7 +57,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);
}
@@ -113,7 +113,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();
}
@@ -176,7 +176,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;
}
@@ -186,7 +190,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;
}
@@ -199,7 +207,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;
}
@@ -210,7 +222,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;
}
@@ -609,11 +625,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
@@ -664,7 +680,7 @@ public abstract class AbstractHttp11Protocol<S> extends
AbstractProtocol<S> {
* {@code UpgradeProtocol}. 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 225fcd36c1..aab2290407 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -148,6 +148,7 @@ public class Http11Processor extends AbstractProcessor {
private SendfileDataBase sendfileData = null;
+ @SuppressWarnings("deprecation")
public Http11Processor(AbstractHttp11Protocol<?> protocol, Adapter
adapter) {
super(adapter);
this.protocol = protocol;
@@ -621,6 +622,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 9aa8d48cd0..4b94b159dc 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 9876af9765..4ec2722b58 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -346,7 +346,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">
@@ -632,7 +635,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="rejectIllegalHeaderName" required="false">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]