Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=41179
Return 404 rather than 400 if no ROOT context is deployed
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc5.5.x/trunk@1158251 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/STATUS.txt b/STATUS.txt
index e9cf3c0..350d8ab 100644
--- a/STATUS.txt
+++ b/STATUS.txt
@@ -94,12 +94,6 @@
I think there is not much demand for this feature in 5.5 to justify this.
The rest of changes and fixes are OK to backport (e.g. allow to specify port numbers).
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=41179
- Return 404 rather than 400 if no ROOT context is deployed
- http://people.apache.org/~markt/patches/2011-07-22-bug41179-tc5.patch
- +1: markt, kfujino, kkolinko
- -1:
-
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51647
Session replication fails with ClassNotFoundException when session attribute
is Java dynamic proxy
diff --git a/container/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java b/container/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java
index e5b9b8d..79466aa 100644
--- a/container/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/container/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java
@@ -311,6 +311,14 @@
request.setContext((Context) request.getMappingData().context);
request.setWrapper((Wrapper) request.getMappingData().wrapper);
+ // If there is no context at this point, it is likely no ROOT context
+ // has been deployed
+ if (request.getContext() == null) {
+ res.setStatus(404);
+ res.setMessage("Not found");
+ return false;
+ }
+
// Filter trace method
if (!connector.getAllowTrace()
&& req.method().equalsIgnoreCase("TRACE")) {
diff --git a/container/webapps/docs/changelog.xml b/container/webapps/docs/changelog.xml
index 9f1e0e1..b17e88e 100644
--- a/container/webapps/docs/changelog.xml
+++ b/container/webapps/docs/changelog.xml
@@ -51,6 +51,10 @@
Stephane Bailliez. (mark)
</fix>
<fix>
+ <bug>41179</bug>: Return 404 rather than 400 for requests to the ROOT
+ context when no ROOT context has been deployed. (markt)
+ </fix>
+ <fix>
<bug>50189</bug>: Once the application has finished writing to the
response, prevent further reads from the request since this causes
various problems in the connectors which do not expect this. (markt)