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/trunk@1793487 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed May 2, 2017
1 parent 4545dcc commit 7d93527
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 @@ -400,6 +400,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 @@ -30,6 +30,7 @@
import java.util.TimeZone;
import java.util.Vector;

import javax.servlet.DispatcherType;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
Expand Down Expand Up @@ -315,6 +316,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 @@ -88,6 +88,12 @@
determining if the current request is for custom error page or not.
(markt)
</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 7d93527

Please sign in to comment.