Old code used stristr.
New code uses strncmp.

If I understand correctly, the old one is case-insensitive, while the
new one is case-sensitive.

Best regards,
Konstantin Kolinko

2011/10/23  <rj...@apache.org>:
> Author: rjung
> Date: Sun Oct 23 16:19:59 2011
> New Revision: 1187916
>
> URL: http://svn.apache.org/viewvc?rev=1187916&view=rev
> Log:
> BZ 51769: IIS: Allow URIs which contain "META-INF" or
> "WEB-INF" as long as they are not path components of the URI.
>
> I kept the old stristr function, because it
> could be useful for something else.
>
> Modified:
>    tomcat/jk/trunk/native/iis/jk_isapi_plugin.c
>    tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
>
> Modified: tomcat/jk/trunk/native/iis/jk_isapi_plugin.c
> URL: 
> http://svn.apache.org/viewvc/tomcat/jk/trunk/native/iis/jk_isapi_plugin.c?rev=1187916&r1=1187915&r2=1187916&view=diff
> ==============================================================================
> --- tomcat/jk/trunk/native/iis/jk_isapi_plugin.c (original)
> +++ tomcat/jk/trunk/native/iis/jk_isapi_plugin.c Sun Oct 23 16:19:59 2011
> @@ -842,12 +842,30 @@ static char *stristr(const char *s, cons
>     return ((char *)s);
>  }
>
> +/*
> + * Find the first occurrence of path in uri tokenized by "/".
> + * The comparison is done case insensitive.
> + */
> +static const char *find_path_in_uri(const char *uri, const char *path)
> +{
> +    size_t len = strlen(path);
> +    while (uri = strchr(uri, '/')) {
> +        uri++;
> +        if (!strncmp(uri, path, len) &&
> +            (*(uri + len) == '/' ||
> +             strlen(uri) == len)) {
> +            return uri;
> +        }
> +    }
> +    return NULL;
> +}
> +
>  static int uri_is_web_inf(const char *uri)
>  {
> -    if (stristr(uri, "/web-inf")) {
> +    if (find_path_in_uri(uri, "web-inf")) {
>         return JK_TRUE;
>     }
> -    if (stristr(uri, "/meta-inf")) {
> +    if (find_path_in_uri(uri, "meta-inf")) {
>         return JK_TRUE;
>     }
>
>
> Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
> URL: 
> http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1187916&r1=1187915&r2=1187916&view=diff
> ==============================================================================
> --- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
> +++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Sun Oct 23 16:19:59 2011
> @@ -45,6 +45,10 @@
>   <subsection name="Native">
>     <changelog>
>       <fix>
> +        <bug>51769</bug>: IIS: Allow URIs which contain "META-INF" or
> +        "WEB-INF" as long as they are not path components of the URI. (rjung)
> +      </fix>
> +      <fix>
>         <bug>52056</bug>: HTTPD: JK request log does not always log
>         correct response status. Fixed by refactoring JK request
>         log to use the standard request log hook. (rjung)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>

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

Reply via email to