You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1997/06/15 13:19:13 UTC

[PATCH] mod_rewrite 3.0.5 -> 3.0.6

A little maintainance patch which brings mod_rewrite from 3.0.5 to 3.0.6 - for
inclusion in the patches-1.2 directory and Apache 1.2.1.  Here is the snippet
from the ChangeLog: 

------
  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
------

The context diff is appended.

Greetings,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

=======
*** mod_rewrite.c.old   Fri Apr 25 01:35:22 1997
--- mod_rewrite.c   Sun Jun 15 13:11:41 1997
***************
*** 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. 
***************
*** 779,784 ****
--- 779,788 ----
               || 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);
      }
***************
*** 1559,1564 ****
--- 1563,1569 ----
              }
              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;
          }
  
***************
*** 1602,1608 ****
          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) {
--- 1607,1613 ----
          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) {
***************
*** 1788,1794 ****
  **
  */
  
! static void splitout_queryargs(request_rec *r)
  {
      char *q;
      char *olduri;
--- 1793,1799 ----
  **
  */
  
! static void splitout_queryargs(request_rec *r, int qsappend)
  {
      char *q;
      char *olduri;
***************
*** 1797,1803 ****
      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);
--- 1802,1811 ----
      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);
*** mod_rewrite.h.old   Thu Apr 17 04:52:51 1997
--- mod_rewrite.h   Sun Jun 15 10:36:00 1997
***************
*** 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);