Skip to content

Commit

Permalink
Ensure that when the Default or WebDAV servlets process an error disp…
Browse files Browse the repository at this point in the history
…atch that the error resource is processed via the doGet() method irrespective of the method used for the original request that triggered the error.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk@1793491 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed May 2, 2017
1 parent 3bfe9fb commit 58b3204
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions java/org/apache/catalina/servlets/DefaultServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,18 @@ protected String getPathPrefix(final HttpServletRequest request) {
}


@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

if (req.getDispatcherType() == DispatcherType.ERROR) {
doGet(req, resp);
} else {
super.service(req, resp);
}
}


/**
* Process a GET request for the specified resource.
*
Expand Down
6 changes: 6 additions & 0 deletions java/org/apache/catalina/servlets/WebdavServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.servlet.DispatcherType;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
Expand Down Expand Up @@ -354,6 +355,11 @@ protected void service(HttpServletRequest req, HttpServletResponse resp)
return;
}

if (req.getDispatcherType() == DispatcherType.ERROR) {
doGet(req, resp);
return;
}

final String method = req.getMethod();

if (debug > 0) {
Expand Down
6 changes: 6 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
<bug>60911</bug>: Ensure NPE will not be thrown when looking for SSL
session ID. Based on a patch by Didier Gutacker. (violetagg)
</fix>
<fix>
Ensure that when the Default or WebDAV servlets process an error
dispatch that the error resource is processed via the
<code>doGet()</code> method irrespective of the method used for the
original request that triggered the error. (markt)
</fix>
</changelog>
</subsection>
<subsection name="Coyote">
Expand Down

0 comments on commit 58b3204

Please sign in to comment.