remm        2004/04/26 08:31:09

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        CoyoteAdapter.java
  Log:
  - Some tweaking for use with the Java in-process protocol handler (at last someone
    was inetersted in the feature :) ).
  - Since this is in-process, forcing to pass the URI as a byte array is stupid, since 
the
    conversion is fairly expensive, and more importantly, it would add a lot of 
complexity
    to the "client" code.
  
  Revision  Changes    Path
  1.24      +23 -16    
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java
  
  Index: CoyoteAdapter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- CoyoteAdapter.java        14 Apr 2004 22:20:47 -0000      1.23
  +++ CoyoteAdapter.java        26 Apr 2004 15:31:09 -0000      1.24
  @@ -225,19 +225,29 @@
           // URI decoding
           MessageBytes decodedURI = req.decodedURI();
           decodedURI.duplicate(req.requestURI());
  -        try {
  -          req.getURLDecoder().convert(decodedURI, false);
  -        } catch (IOException ioe) {
  -          res.setStatus(400);
  -          res.setMessage("Invalid URI");
  -          throw ioe;
  -        }
   
  -        // Normalize decoded URI
  -        if (!normalize(req.decodedURI())) {
  -            res.setStatus(400);
  -            res.setMessage("Invalid URI");
  -            return false;
  +        if (decodedURI.getType() == MessageBytes.T_BYTES) {
  +            // %xx decoding of the URL
  +            try {
  +                req.getURLDecoder().convert(decodedURI, false);
  +            } catch (IOException ioe) {
  +                res.setStatus(400);
  +                res.setMessage("Invalid URI");
  +                throw ioe;
  +            }
  +            // Normalization
  +            if (!normalize(req.decodedURI())) {
  +                res.setStatus(400);
  +                res.setMessage("Invalid URI");
  +                return false;
  +            }
  +            // Character decoding
  +            convertURI(decodedURI, request);
  +        } else {
  +            // The URL is chars or String, and has been sent using an in-memory
  +            // protocol handler, we have to assume the URL has been properly
  +            // decoded already
  +            decodedURI.toChars();
           }
   
           // Set the remote principal
  @@ -251,9 +261,6 @@
           if (authtype != null) {
               request.setAuthType(authtype);
           }
  -
  -        // URI character decoding
  -        convertURI(decodedURI, request);
   
           // Parse session Id
           parseSessionId(req, request);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to