marcsaeg    01/03/15 11:00:42

  Modified:    src/share/org/apache/tomcat/core Tag: tomcat_32
                        RequestImpl.java
  Log:
  The servlet path and path info were being stored in their URL encoded
  form which violates the servlet spec.
  
  According to the Servlet 2.2 API specification errata dated 4/27/2000,
  the servlet path, path info and path translated values (i.e.
  getServletPath(), getPathInfo() and getPathTranslated()) should return
  decoded values.
  
  For example
  
     http://localhost/space+test.html
  
  should return a servlet path of
  
    /space test.html
  
  and
     http://localhost/servlet/SnoopServlet/path%20info
  
  should return a path info of
  
     /path info
  
  PR: 657/Bugzilla 369
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.52.2.7  +14 -2     
jakarta-tomcat/src/share/org/apache/tomcat/core/Attic/RequestImpl.java
  
  Index: RequestImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Attic/RequestImpl.java,v
  retrieving revision 1.52.2.6
  retrieving revision 1.52.2.7
  diff -u -r1.52.2.6 -r1.52.2.7
  --- RequestImpl.java  2001/03/06 01:09:51     1.52.2.6
  +++ RequestImpl.java  2001/03/15 19:00:37     1.52.2.7
  @@ -573,7 +573,13 @@
   
   
       public void setPathInfo(String pathInfo) {
  -        this.pathInfo = pathInfo;
  +        try{
  +            this.pathInfo = RequestUtil.URLDecode(pathInfo);
  +        }catch(Exception e){
  +            if(contextM != null)
  +                contextM.log("RequestImpl.setPathInfo: Unable to decode pathInfo, 
using encoded version.  pathInfo = " + pathInfo);
  +            this.pathInfo = pathInfo;
  +        }
       }
   
       /** Set query string - will be called by forward
  @@ -585,7 +591,13 @@
       }
   
       public void setServletPath(String servletPath) {
  -     this.servletPath = servletPath;
  +        try{
  +            this.servletPath = RequestUtil.URLDecode(servletPath);
  +        }catch(Exception e){
  +            if(contextM != null)
  +                contextM.log("RequestImpl.setServletPath: Unable to decode servlet 
path, using encoded version.  path = " + servletPath);
  +            this.servletPath = servletPath;
  +        }
       }
   
   
  
  
  

Reply via email to