You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Marc Slemko <ma...@hyperreal.com> on 1997/06/22 05:45:03 UTC

cvs commit: apache/src mod_rewrite.c mod_rewrite.h

marc        97/06/21 20:45:02

  Modified:    src       mod_rewrite.c mod_rewrite.h
  Log:
  Update mod_rewrite to v3.0.6:
  
  ------
    970615 - added a new ruleflag (QSA=query_string_append) and
             changed the behaviour when a QUERY_STRING is generated (xxx?...):
             In the past mod_rewrite always _appended_ the existing QUERY_STRING
             to the generated one which caused _a lot of confusing_ for the
  users.
             Now the generated QUERY_STRING per default _REPLACES_ the
             existing one completely, except if the QSA flag is used.
             Now it acts the way the users always want to use it.
  
           - fixed a nasty bug in per-dir context:
             when a URL http://... was used in concunction with
             a special redirect flag, e.g. R=permanent, the
             permanent status was lost.
             [Thanks to Ronald Tschalaer <Ro...@psi.ch> for hint]
  
           - added Q.08 and Q.09 to the FAQ/documentation
  ------
  
  Reviewed by:	Alexei Kosut, Dean Gaudet, Marc Slemko
  Submitted by:	Ralf S. Engelschall
  
  Revision  Changes    Path
  1.31      +12 -4     apache/src/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -C3 -r1.30 -r1.31
  *** mod_rewrite.c	1997/06/16 15:38:55	1.30
  --- mod_rewrite.c	1997/06/22 03:45:00	1.31
  ***************
  *** 61,67 ****
    **  |_| |_| |_|\___/ \__,_|___|_|  \___| \_/\_/ |_|  |_|\__\___|
    **                       |_____|
    **
  ! **  URL Rewriting Module, Version 3.0.5 (16-Apr-1997)
    **
    **  This module uses a rule-based rewriting engine (based on a
    **  regular-expression parser) to rewrite requested URLs on the fly. 
  --- 61,67 ----
    **  |_| |_| |_|\___/ \__,_|___|_|  \___| \_/\_/ |_|  |_|\__\___|
    **                       |_____|
    **
  ! **  URL Rewriting Module, Version 3.0.6 (15-Jun-1997)
    **
    **  This module uses a rule-based rewriting engine (based on a
    **  regular-expression parser) to rewrite requested URLs on the fly. 
  ***************
  *** 781,786 ****
  --- 781,790 ----
                 || strcasecmp(key, "G") == 0   ) {
            cfg->flags |= RULEFLAG_GONE;
        }
  +     else if (   strcasecmp(key, "qsappend") == 0
  +              || strcasecmp(key, "QSA") == 0   ) {
  +         cfg->flags |= RULEFLAG_QSAPPEND;
  +     }
        else {
            return pstrcat(p, "RewriteRule: unknown flag '", key, "'\n", NULL);
        }
  ***************
  *** 1561,1566 ****
  --- 1565,1571 ----
                }
                rewritelog(r, 2, "[per-dir %s] redirect %s -> %s", perdir, r->filename, newuri);
                r->filename = pstrdup(r->pool, newuri);
  +             r->status = p->forced_responsecode;
                return 1;
            }
    
  ***************
  *** 1604,1610 ****
            reduce_uri(r);
    
            /* split out on-the-fly generated QUERY_STRING '....?xxxxx&xxxx...' */
  !         splitout_queryargs(r);
    
            /* if a MIME-type should be later forced for this URL, then remember this */
            if (p->forced_mimetype != NULL) {
  --- 1609,1615 ----
            reduce_uri(r);
    
            /* split out on-the-fly generated QUERY_STRING '....?xxxxx&xxxx...' */
  !         splitout_queryargs(r, p->flags & RULEFLAG_QSAPPEND);
    
            /* if a MIME-type should be later forced for this URL, then remember this */
            if (p->forced_mimetype != NULL) {
  ***************
  *** 1790,1796 ****
    **
    */
    
  ! static void splitout_queryargs(request_rec *r)
    {
        char *q;
        char *olduri;
  --- 1795,1801 ----
    **
    */
    
  ! static void splitout_queryargs(request_rec *r, int qsappend)
    {
        char *q;
        char *olduri;
  ***************
  *** 1799,1805 ****
        if (q != NULL) {
            olduri = pstrdup(r->pool, r->filename);
            *q++ = '\0';
  !         r->args = pstrcat(r->pool, q, "&", r->args, NULL);
            if (r->args[strlen(r->args)-1] == '&')
                r->args[strlen(r->args)-1] = '\0';
            rewritelog(r, 3, "split uri=%s -> uri=%s, args=%s", olduri, r->filename, r->args);
  --- 1804,1813 ----
        if (q != NULL) {
            olduri = pstrdup(r->pool, r->filename);
            *q++ = '\0';
  !         if (qsappend)
  !             r->args = pstrcat(r->pool, q, "&", r->args, NULL);
  !         else
  !             r->args = pstrdup(r->pool, q);
            if (r->args[strlen(r->args)-1] == '&')
                r->args[strlen(r->args)-1] = '\0';
            rewritelog(r, 3, "split uri=%s -> uri=%s, args=%s", olduri, r->filename, r->args);
  
  
  
  1.25      +3 -2      apache/src/mod_rewrite.h
  
  Index: mod_rewrite.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_rewrite.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -C3 -r1.24 -r1.25
  *** mod_rewrite.h	1997/06/16 12:47:53	1.24
  --- mod_rewrite.h	1997/06/22 03:45:01	1.25
  ***************
  *** 64,70 ****
    **  |_| |_| |_|\___/ \__,_|___|_|  \___| \_/\_/ |_|  |_|\__\___|
    **                       |_____|
    **
  ! **  URL Rewriting Module, Version 3.0.5 (16-Apr-1997)
    **
    **  This module uses a rule-based rewriting engine (based on a
    **  regular-expression parser) to rewrite requested URLs on the fly. 
  --- 64,70 ----
    **  |_| |_| |_|\___/ \__,_|___|_|  \___| \_/\_/ |_|  |_|\__\___|
    **                       |_____|
    **
  ! **  URL Rewriting Module, Version 3.0.6 (15-Jun-1997)
    **
    **  This module uses a rule-based rewriting engine (based on a
    **  regular-expression parser) to rewrite requested URLs on the fly. 
  ***************
  *** 171,176 ****
  --- 171,177 ----
    #define RULEFLAG_PASSTHROUGH        1<<8
    #define RULEFLAG_FORBIDDEN          1<<9
    #define RULEFLAG_GONE               1<<10
  + #define RULEFLAG_QSAPPEND           1<<11
    
    #define MAPTYPE_TXT                 1<<0
    #define MAPTYPE_DBM                 1<<1
  ***************
  *** 334,340 ****
    static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p, char *perdir); 
    
        /* URI transformation function */
  ! static void  splitout_queryargs(request_rec *r);
    static void  reduce_uri(request_rec *r);
    static char *expand_tildepaths(request_rec *r, char *uri);
    static void  expand_map_lookups(request_rec *r, char *uri, int uri_len);
  --- 335,341 ----
    static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p, char *perdir); 
    
        /* URI transformation function */
  ! static void  splitout_queryargs(request_rec *r, int qsappend);
    static void  reduce_uri(request_rec *r);
    static char *expand_tildepaths(request_rec *r, char *uri);
    static void  expand_map_lookups(request_rec *r, char *uri, int uri_len);