Author: markt Date: Sat May 12 21:00:02 2012 New Revision: 1337648 URL: http://svn.apache.org/viewvc?rev=1337648&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53067
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/catalina/websocket/WebSocketServlet.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1337643 Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/websocket/WebSocketServlet.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/websocket/WebSocketServlet.java?rev=1337648&r1=1337647&r2=1337648&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/websocket/WebSocketServlet.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/websocket/WebSocketServlet.java Sat May 12 21:00:02 2012 @@ -27,6 +27,8 @@ import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletRequestWrapper; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -112,9 +114,19 @@ public abstract class WebSocketServlet e // TODO } - // Small hack until the Servlet API provides a way to do this. StreamInbound inbound = createWebSocketInbound(subProtocol); - ((RequestFacade) req).doUpgrade(inbound); + + // Small hack until the Servlet API provides a way to do this. + ServletRequest inner = req; + // Unwrap the request + while (inner instanceof ServletRequestWrapper) { + inner = ((ServletRequestWrapper) inner).getRequest(); + } + if (inner instanceof RequestFacade) { + ((RequestFacade) req).doUpgrade(inbound); + } else { + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1337648&r1=1337647&r2=1337648&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sat May 12 21:00:02 2012 @@ -108,6 +108,10 @@ <bug>53062</bug>: When constructing absolute URLs for redirects from relative URLs ensure that the resulting URLs are normalized. (markt) </fix> + <fix> + <bug>53067</bug>: Ensure the WebSocket Servlet continues to work when + requests are wrapped. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org