tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44897] New: HttpServletRequest's .getParameter(String) method returns null for parameters with invalid URL encodings
Date Mon, 28 Apr 2008 22:25:02 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=44897

           Summary: HttpServletRequest's .getParameter(String) method
                    returns null for parameters with invalid URL encodings
           Product: Tomcat 5
           Version: 5.5.26
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: calebjones@gmail.com


As per the JavaDocs:
http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletRequest.html#getParameter(java.lang.String)

"public java.lang.String getParameter(java.lang.String name)

Returns the value of a request parameter as a String, or null if the parameter
does not exist..."

However, given the following URL:
http://localhost/webappName/?foo=bar%4xbaz

httpServletRequestObject.getParameter("foo") will return null despite the
existence of the parameter "foo".

The problem, as far as I can tell, is the presence of the invalid URL encoding
'%xy' (where x or y are any non hexadecimal character).  I expected that
getParameter("foo") would do one of the following in this situation:

1. Return "bar%4xbaz" (as does other languages such as PHP or Ruby on Rails)
2. Throw a Java UnsupportedEncodingException (see
http://java.sun.com/j2se/1.5.0/docs/api/java/io/UnsupportedEncodingException.html).

Making the data inaccessible via getParameter(String) (ie: returning null)
seems to be less helpful than either one of the above.

I was able to confirm this behavior in Tomcat 5.0.23 as well as 5.5.26.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message