You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2001/10/21 19:48:21 UTC
cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
wrowe 01/10/21 10:48:21
Modified: modules/mappers mod_rewrite.c
Log:
The test of filename[0] == '/' is very evil ;)
More patches required to;
1. use apr_filepath_merge rather than apr_pstrcat for creating proper
and canonical paths.
2. untangle the proxy: fooness that no longer works in directory_walk.
Revision Changes Path
1.84 +5 -5 httpd-2.0/modules/mappers/mod_rewrite.c
Index: mod_rewrite.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- mod_rewrite.c 2001/10/21 01:24:35 1.83
+++ mod_rewrite.c 2001/10/21 17:48:21 1.84
@@ -1222,8 +1222,8 @@
#endif
rewritelog(r, 2, "local path result: %s", r->filename);
- /* the filename has to start with a slash! */
- if (r->filename[0] != '/') {
+ /* the filename must be an absolute path! */
+ if (!ap_os_is_path_absolute(r->pool, r->filename)) {
return HTTP_BAD_REQUEST;
}
@@ -1508,7 +1508,7 @@
}
/* the filename has to start with a slash! */
- if (r->filename[0] != '/') {
+ if (!ap_os_is_path_absolute(r->pool, r->filename)) {
return HTTP_BAD_REQUEST;
}
@@ -1990,7 +1990,7 @@
* location, i.e. if it's not starting with either a slash
* or a fully qualified URL scheme.
*/
- if (prefixstrip && r->filename[0] != '/'
+ if (prefixstrip && !ap_os_is_path_absolute(r->pool, r->filename)
&& !is_absolute_uri(r->filename)) {
rewritelog(r, 3, "[per-dir %s] add per-dir prefix: %s -> %s%s",
perdir, r->filename, perdir, r->filename);
@@ -2077,7 +2077,7 @@
* not start with a slash. Here we add again the initially
* stripped per-directory prefix.
*/
- if (prefixstrip && r->filename[0] != '/') {
+ if (prefixstrip && !ap_os_is_path_absolute(r->pool, r->filename)) {
rewritelog(r, 3, "[per-dir %s] add per-dir prefix: %s -> %s%s",
perdir, r->filename, perdir, r->filename);
r->filename = apr_pstrcat(r->pool, perdir, r->filename, NULL);