You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2024/06/26 06:13:34 UTC
Re: svn commit: r1918623 - /httpd/httpd/trunk/modules/mappers/mod_rewrite.c
On 6/25/24 9:43 PM, covener@apache.org wrote:
> Author: covener
> Date: Tue Jun 25 19:43:15 2024
> New Revision: 1918623
>
> URL: http://svn.apache.org/viewvc?rev=1918623&view=rev
> Log:
> fix comparison of local path on Windows
>
> Submitted By: Yann Ylavic
>
> Modified:
> httpd/httpd/trunk/modules/mappers/mod_rewrite.c
>
> Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1918623&r1=1918622&r2=1918623&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
> +++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Tue Jun 25 19:43:15 2024
> @@ -683,6 +683,19 @@ static unsigned is_absolute_uri(char *ur
> return 0;
> }
>
> +static int is_absolute_path(const char *path)
> +{
> +#ifndef WIN32
> + return (path[0] == '/');
> +#else
> +#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
> + /* "//", "\\", "x:/" and "x:\" are absolute paths on Windows */
> + return ((IS_SLASH(path[0]) && path[1] == path[0])
> + || (apr_isalpha(path[0]) && path[1] == ':' && IS_SLASH(path[2])));
> +#undef IS_SLASH
> +#endif
> +}
> +
Wouldn't it be better to move the stuff in
https://github.com/apache/httpd/blob/7672c68e4a0425fae45df49a44925b06cbde21f6/server/util.c#L83-L89
(probably needs prefixing with AP_) to a header file (httpd.h?) and use this instead?
Regards
RĂ¼diger