httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Thu, 26 Aug 2004 21:53:24 GMT
nd          2004/08/26 14:53:24

  Modified:    .        Tag: APACHE_2_0_BRANCH CHANGES STATUS
               modules/mappers Tag: APACHE_2_0_BRANCH mod_rewrite.c
  Log:
  add support for rewrite rules in proxy containers
  
  PR: 27985
  Reviewed by: Jeff Trawick, Bill Stoddard
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.988.2.336 +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.335
  retrieving revision 1.988.2.336
  diff -u -u -r1.988.2.335 -r1.988.2.336
  --- CHANGES	26 Aug 2004 20:54:24 -0000	1.988.2.335
  +++ CHANGES	26 Aug 2004 21:53:22 -0000	1.988.2.336
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.51
   
  +  *) mod_rewrite now officially supports RewriteRules in <Proxy> sections.
  +     PR 27985.  [André Malo]
  +
     *) mod_disk_cache: Implement binary format for on-disk header files.
        [Brian Akins <bakins web.turner.com>, Justin Erenkrantz]
   
  
  
  
  1.751.2.1021 +1 -5      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.1020
  retrieving revision 1.751.2.1021
  diff -u -u -r1.751.2.1020 -r1.751.2.1021
  --- STATUS	26 Aug 2004 21:18:37 -0000	1.751.2.1020
  +++ STATUS	26 Aug 2004 21:53:23 -0000	1.751.2.1021
  @@ -178,10 +178,6 @@
            http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/loggers/mod_log_config.c?r1=1.118&r2=1.119
          +1: trawick, nd, jerenkrantz
   
  -    *) (re-)add support for RewriteRules in <Proxy> containers. PR 27985
  -         modules/mappers/mod_rewrite.c: r1.254
  -       +1: nd, trawick, stoddard
  -
       *) mod_include: remove "recursive-include" check, it's no longer
          necessary and forbids legal actions.
             modules/filters/mod_include.c: r1.296
  
  
  
  No                   revision
  No                   revision
  1.135.2.28 +24 -7     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.135.2.27
  retrieving revision 1.135.2.28
  diff -u -u -r1.135.2.27 -r1.135.2.28
  --- mod_rewrite.c	20 Aug 2004 21:17:40 -0000	1.135.2.27
  +++ mod_rewrite.c	26 Aug 2004 21:53:24 -0000	1.135.2.28
  @@ -1395,6 +1395,7 @@
       int rulestatus;
       int n;
       char *ofilename;
  +    int is_proxyreq;
   
       dconf = (rewrite_perdir_conf *)ap_get_module_config(r->per_dir_config,
                                                           &rewrite_module);
  @@ -1416,15 +1417,23 @@
       }
   
       /*
  +     * Proxy request?
  +     */
  +  	is_proxyreq = (   r->proxyreq && r->filename
  +  	               && !strncmp(r->filename, "proxy:", 6));
  +
  +    /*
        *  .htaccess file is called before really entering the directory, i.e.:
        *  URL: http://localhost/foo  and .htaccess is located in foo directory
        *  Ignore such attempts, since they may lead to undefined behaviour.
        */
  -    l = strlen(dconf->directory) - 1;
  -    if (r->filename && strlen(r->filename) == l &&
  -        (dconf->directory)[l] == '/' &&
  -        !strncmp(r->filename, dconf->directory, l)) {
  -        return DECLINED;
  +    if (is_proxyreq) {
  +        l = strlen(dconf->directory) - 1;
  +        if (r->filename && strlen(r->filename) == l &&
  +            (dconf->directory)[l] == '/' &&
  +            !strncmp(r->filename, dconf->directory, l)) {
  +            return DECLINED;
  +        }
       }
   
       /*
  @@ -1920,6 +1929,7 @@
       rewritecond_entry *c;
       int i;
       int rc;
  +    int is_proxyreq = 0;
   
       /*
        *  Initialisation
  @@ -1945,7 +1955,13 @@
        *  threatment in the logfile.
        */
       if (perdir) {
  -        if (   strlen(uri) >= strlen(perdir)
  +        /*
  +  	     * Proxy request?
  +         */
  +  	    is_proxyreq = (   r->proxyreq && r->filename
  +  	                   && !strncmp(r->filename, "proxy:", 6));
  +
  +        if (   !is_proxyreq && strlen(uri) >= strlen(perdir)
               && strncmp(uri, perdir, strlen(perdir)) == 0) {
               rewritelog(r, 3, "[per-dir %s] strip per-dir prefix: %s -> %s",
                          perdir, uri, uri+strlen(perdir));
  @@ -2145,7 +2161,8 @@
        *   location, i.e. if it's not an absolute URL (!) path nor
        *   a fully qualified URL scheme.
        */
  -    if (perdir && *r->filename != '/' && !is_absolute_uri(r->filename))
{
  +    if (   perdir && !is_proxyreq && *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);
           r->filename = apr_pstrcat(r->pool, perdir, r->filename, NULL);
  
  
  

Mime
View raw message