You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rodent of Unusual Size <co...@decus.org> on 1997/07/03 13:27:01 UTC

[PATCH] to fix mod_userdir's broken handling of ///~user

    As pointed out by Nick Allen <na...@acm.org> in PR#805, mod_userdir
    makes the assumption that r->uri *has* to start with "/~" or else it
    won't work. "///~user" will not.  This patch addresses that by
    collapsing duplicated slashes before making the test.

    It's unclear whether "/~user" and "///~user" should be considered
    equivalent.  Any thoughts?  Roy?  I can't seem to find anything onw
    way or the other..

    #ken    :-)}

Index: mod_userdir.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_userdir.c,v
retrieving revision 1.17
diff -c -r1.17 mod_userdir.c
*** mod_userdir.c	1997/06/30 20:38:53	1.17
--- mod_userdir.c	1997/07/03 11:22:27
***************
*** 190,204 ****
      void *server_conf = r->server->module_config;
      const userdir_config *s_cfg =
              (userdir_config *) get_module_config (server_conf, &userdir_module);
!     char *name = r->uri;
      const char *userdirs = pstrdup (r->pool, s_cfg->userdir);
      const char *w, *dname, *redirect;
      char *x = NULL;
  
      /*
       * If the URI doesn't match our basic pattern, we've nothing to do with
!      * it.
       */
      if (
          (s_cfg->userdir == NULL) ||
          (name[0] != '/') ||
--- 190,205 ----
      void *server_conf = r->server->module_config;
      const userdir_config *s_cfg =
              (userdir_config *) get_module_config (server_conf, &userdir_module);
!     char *name = pstrdup (r->pool, r->uri);
      const char *userdirs = pstrdup (r->pool, s_cfg->userdir);
      const char *w, *dname, *redirect;
      char *x = NULL;
  
      /*
       * If the URI doesn't match our basic pattern, we've nothing to do with
!      * it.  Edit out any repeated slashes from our copy of the URI first.
       */
+     no2slash (name);
      if (
          (s_cfg->userdir == NULL) ||
          (name[0] != '/') ||
***************
*** 207,213 ****
          return DECLINED;
      }
  
!     dname = name + 2;
      w = getword(r->pool, &dname, '/');
  
      /*
--- 208,215 ----
          return DECLINED;
      }
  
!     name = strchr (r->uri, '~');
!     dname = --name + 2;
      w = getword(r->pool, &dname, '/');
  
      /*

Re: [PATCH] to fix mod_userdir's broken handling of ///~user

Posted by Brian Behlendorf <br...@organic.com>.
Let me clarify my veto.  I believe it is a Good Thing to fight URL
variance.  URL variance is when two or more URLs point at the same
resource.  This causes proxy caches and local caches to expand needlessly,
and search engines to return multiple references to the same page.  In my
opinion we're pretty liberal on this already, what with Unix-style
collapsing of multiple ///, but I understand the need for that for
backwards compatibility.  

	Brian


--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
"Why not?" - TL                brian@organic.com - hyperreal.org - apache.org

Re: [PATCH] to fix mod_userdir's broken handling of ///~user

Posted by Dean Gaudet <dg...@arctic.org>.
~ isn't a valid url character, so I doubt you'll find anything official on
it.

What does NCSA do?  Or other servers for that matter?

Dean

On Thu, 3 Jul 1997, Rodent of Unusual Size wrote:

>     As pointed out by Nick Allen <na...@acm.org> in PR#805, mod_userdir
>     makes the assumption that r->uri *has* to start with "/~" or else it
>     won't work. "///~user" will not.  This patch addresses that by
>     collapsing duplicated slashes before making the test.
> 
>     It's unclear whether "/~user" and "///~user" should be considered
>     equivalent.  Any thoughts?  Roy?  I can't seem to find anything onw
>     way or the other..
> 
>     #ken    :-)}
> 
> Index: mod_userdir.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/mod_userdir.c,v
> retrieving revision 1.17
> diff -c -r1.17 mod_userdir.c
> *** mod_userdir.c	1997/06/30 20:38:53	1.17
> --- mod_userdir.c	1997/07/03 11:22:27
> ***************
> *** 190,204 ****
>       void *server_conf = r->server->module_config;
>       const userdir_config *s_cfg =
>               (userdir_config *) get_module_config (server_conf, &userdir_module);
> !     char *name = r->uri;
>       const char *userdirs = pstrdup (r->pool, s_cfg->userdir);
>       const char *w, *dname, *redirect;
>       char *x = NULL;
>   
>       /*
>        * If the URI doesn't match our basic pattern, we've nothing to do with
> !      * it.
>        */
>       if (
>           (s_cfg->userdir == NULL) ||
>           (name[0] != '/') ||
> --- 190,205 ----
>       void *server_conf = r->server->module_config;
>       const userdir_config *s_cfg =
>               (userdir_config *) get_module_config (server_conf, &userdir_module);
> !     char *name = pstrdup (r->pool, r->uri);
>       const char *userdirs = pstrdup (r->pool, s_cfg->userdir);
>       const char *w, *dname, *redirect;
>       char *x = NULL;
>   
>       /*
>        * If the URI doesn't match our basic pattern, we've nothing to do with
> !      * it.  Edit out any repeated slashes from our copy of the URI first.
>        */
> +     no2slash (name);
>       if (
>           (s_cfg->userdir == NULL) ||
>           (name[0] != '/') ||
> ***************
> *** 207,213 ****
>           return DECLINED;
>       }
>   
> !     dname = name + 2;
>       w = getword(r->pool, &dname, '/');
>   
>       /*
> --- 208,215 ----
>           return DECLINED;
>       }
>   
> !     name = strchr (r->uri, '~');
> !     dname = --name + 2;
>       w = getword(r->pool, &dname, '/');
>   
>       /*
> 


Re: [PATCH] to fix mod_userdir's broken handling of ///~user

Posted by Brian Behlendorf <br...@organic.com>.
-1.  I think the current behavior is preferable, personally.

	Brian

At 07:27 AM 7/3/97 -0400, Rodent of Unusual Size wrote:
>    As pointed out by Nick Allen <na...@acm.org> in PR#805, mod_userdir
>    makes the assumption that r->uri *has* to start with "/~" or else it
>    won't work. "///~user" will not.  This patch addresses that by
>    collapsing duplicated slashes before making the test.
>
>    It's unclear whether "/~user" and "///~user" should be considered
>    equivalent.  Any thoughts?  Roy?  I can't seem to find anything onw
>    way or the other..
>
>    #ken    :-)}
>
>Index: mod_userdir.c
>===================================================================
>RCS file: /export/home/cvs/apache/src/mod_userdir.c,v
>retrieving revision 1.17
>diff -c -r1.17 mod_userdir.c
>*** mod_userdir.c	1997/06/30 20:38:53	1.17
>--- mod_userdir.c	1997/07/03 11:22:27
>***************
>*** 190,204 ****
>      void *server_conf = r->server->module_config;
>      const userdir_config *s_cfg =
>              (userdir_config *) get_module_config (server_conf,
&userdir_module);
>!     char *name = r->uri;
>      const char *userdirs = pstrdup (r->pool, s_cfg->userdir);
>      const char *w, *dname, *redirect;
>      char *x = NULL;
>  
>      /*
>       * If the URI doesn't match our basic pattern, we've nothing to do with
>!      * it.
>       */
>      if (
>          (s_cfg->userdir == NULL) ||
>          (name[0] != '/') ||
>--- 190,205 ----
>      void *server_conf = r->server->module_config;
>      const userdir_config *s_cfg =
>              (userdir_config *) get_module_config (server_conf,
&userdir_module);
>!     char *name = pstrdup (r->pool, r->uri);
>      const char *userdirs = pstrdup (r->pool, s_cfg->userdir);
>      const char *w, *dname, *redirect;
>      char *x = NULL;
>  
>      /*
>       * If the URI doesn't match our basic pattern, we've nothing to do with
>!      * it.  Edit out any repeated slashes from our copy of the URI first.
>       */
>+     no2slash (name);
>      if (
>          (s_cfg->userdir == NULL) ||
>          (name[0] != '/') ||
>***************
>*** 207,213 ****
>          return DECLINED;
>      }
>  
>!     dname = name + 2;
>      w = getword(r->pool, &dname, '/');
>  
>      /*
>--- 208,215 ----
>          return DECLINED;
>      }
>  
>!     name = strchr (r->uri, '~');
>!     dname = --name + 2;
>      w = getword(r->pool, &dname, '/');
>  
>      /*
>
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
"Why not?" - TL                brian@organic.com - hyperreal.org - apache.org