hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Grytsovets (JIRA)" <j...@apache.org>
Subject [jira] Created: (HTTPCLIENT-1043) BasicPathHandler match bug
Date Fri, 14 Jan 2011 12:29:46 GMT
BasicPathHandler match bug
--------------------------

                 Key: HTTPCLIENT-1043
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1043
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.1 Beta1, 4.1 Alpha2, 4.1 Alpha1, 4.0.3, 4.0.2, 4.0.1
            Reporter: Dmitry Grytsovets
            Priority: Critical
             Fix For: 4.1.0, Future


in BasicPathHandler

   boolean match = targetpath.startsWith (topmostPath);
        // if there is a match and these values are not exactly the same we have
        // to make sure we're not matcing "/foobar" and "/foo"
        if (match && targetpath.length() != topmostPath.length()) {
            if (!topmostPath.endsWith("/")) {
                match = (targetpath.charAt(topmostPath.length()) == '/');
            }
        }

must be changed to

   boolean match = topmostPath.startsWith (targetpath);
        // if there is a match and these values are not exactly the same we have
        // to make sure we're not matcing "/foobar" and "/foo"
        if (match && targetpath.length() != topmostPath.length()) {
            if (!topmostPath.endsWith("/")) {
                match = (topmostPath.charAt(targetpath.length()) == '/');
            }
        }

example 

targetpath = "/stat/" // where are you
topmostPath  = "/stat/domain.tld/" // cookie for path

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message