You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1997/07/05 22:00:25 UTC

[BUG] mod_rewrite and redirect code

The following rule:

    RewriteRule ^/~marcs/(.*) http://valis/~marcs/$1 [redirect=permanent]

still returns a 302 instead of a 301 like it should.  PR#777 is also about
this. 

The following patch fixes it, but I haven't really had the time to look
and see if it is correct.  Ralf?

Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
retrieving revision 1.31
diff -c -r1.31 mod_rewrite.c
*** mod_rewrite.c	1997/06/22 03:45:00	1.31
--- mod_rewrite.c	1997/07/05 19:53:34
***************
*** 1624,1629 ****
--- 1624,1630 ----
             and the current URL still is not a fully qualified one we
             finally prefix it with http[s]://<ourname> explicitly */
          if (flags & RULEFLAG_FORCEREDIRECT) {
+             r->status = p->forced_responsecode;
              if (  !(strlen(r->filename) > 7 &&
                      strncmp(r->filename, "http://", 7) == 0)
                 && !(strlen(r->filename) > 8 &&
***************
*** 1659,1665 ****
                  else
                      rewritelog(r, 2, "[per-dir %s] prepare forced redirect %s -> %s", perdir, r->filename, newuri);
                  r->filename = pstrdup(r->pool, newuri);
-                 r->status = p->forced_responsecode;
                  return 1;
              }
          }
--- 1660,1665 ----


Re: [BUG] mod_rewrite and redirect code

Posted by Marc Slemko <ma...@worldgate.com>.
He did?  You're cheating, reading your mail...

Ok, then yes, this is done.  PR closed.

On Sun, 13 Jul 1997, Dean Gaudet wrote:

> Ralf just committed something though, bringing us up to 3.0.9 ... This
> patch below has two +1s already.  I'm just trying to clear out the backlog
> of pending patches in my mailbox. 
> 
> Dean
> 
> On Sun, 13 Jul 1997, Marc Slemko wrote:
> 
> > No, I skipped it because Ralf is including it in his patch which is, I
> > think, still awaiting votes.  Hint, hint.
> > 
> > On Sun, 13 Jul 1997, Dean Gaudet wrote:
> > 
> > > Did this go in?  PR#777 is still open.
> > > 
> > > Dean
> > > 
> > > On Sat, 5 Jul 1997, Marc Slemko wrote:
> > > 
> > > > The following rule:
> > > > 
> > > >     RewriteRule ^/~marcs/(.*) http://valis/~marcs/$1 [redirect=permanent]
> > > > 
> > > > still returns a 302 instead of a 301 like it should.  PR#777 is also about
> > > > this. 
> > > > 
> > > > The following patch fixes it, but I haven't really had the time to look
> > > > and see if it is correct.  Ralf?
> > > > 
> > > > Index: mod_rewrite.c
> > > > ===================================================================
> > > > RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
> > > > retrieving revision 1.31
> > > > diff -c -r1.31 mod_rewrite.c
> > > > *** mod_rewrite.c	1997/06/22 03:45:00	1.31
> > > > --- mod_rewrite.c	1997/07/05 19:53:34
> > > > ***************
> > > > *** 1624,1629 ****
> > > > --- 1624,1630 ----
> > > >              and the current URL still is not a fully qualified one we
> > > >              finally prefix it with http[s]://<ourname> explicitly */
> > > >           if (flags & RULEFLAG_FORCEREDIRECT) {
> > > > +             r->status = p->forced_responsecode;
> > > >               if (  !(strlen(r->filename) > 7 &&
> > > >                       strncmp(r->filename, "http://", 7) == 0)
> > > >                  && !(strlen(r->filename) > 8 &&
> > > > ***************
> > > > *** 1659,1665 ****
> > > >                   else
> > > >                       rewritelog(r, 2, "[per-dir %s] prepare forced redirect %s -> %s", perdir, r->filename, newuri);
> > > >                   r->filename = pstrdup(r->pool, newuri);
> > > > -                 r->status = p->forced_responsecode;
> > > >                   return 1;
> > > >               }
> > > >           }
> > > > --- 1660,1665 ----
> > > > 
> > > > 
> > > 
> > 
> > 
> 


Re: [BUG] mod_rewrite and redirect code

Posted by Dean Gaudet <dg...@arctic.org>.
Ralf just committed something though, bringing us up to 3.0.9 ... This
patch below has two +1s already.  I'm just trying to clear out the backlog
of pending patches in my mailbox. 

Dean

On Sun, 13 Jul 1997, Marc Slemko wrote:

> No, I skipped it because Ralf is including it in his patch which is, I
> think, still awaiting votes.  Hint, hint.
> 
> On Sun, 13 Jul 1997, Dean Gaudet wrote:
> 
> > Did this go in?  PR#777 is still open.
> > 
> > Dean
> > 
> > On Sat, 5 Jul 1997, Marc Slemko wrote:
> > 
> > > The following rule:
> > > 
> > >     RewriteRule ^/~marcs/(.*) http://valis/~marcs/$1 [redirect=permanent]
> > > 
> > > still returns a 302 instead of a 301 like it should.  PR#777 is also about
> > > this. 
> > > 
> > > The following patch fixes it, but I haven't really had the time to look
> > > and see if it is correct.  Ralf?
> > > 
> > > Index: mod_rewrite.c
> > > ===================================================================
> > > RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
> > > retrieving revision 1.31
> > > diff -c -r1.31 mod_rewrite.c
> > > *** mod_rewrite.c	1997/06/22 03:45:00	1.31
> > > --- mod_rewrite.c	1997/07/05 19:53:34
> > > ***************
> > > *** 1624,1629 ****
> > > --- 1624,1630 ----
> > >              and the current URL still is not a fully qualified one we
> > >              finally prefix it with http[s]://<ourname> explicitly */
> > >           if (flags & RULEFLAG_FORCEREDIRECT) {
> > > +             r->status = p->forced_responsecode;
> > >               if (  !(strlen(r->filename) > 7 &&
> > >                       strncmp(r->filename, "http://", 7) == 0)
> > >                  && !(strlen(r->filename) > 8 &&
> > > ***************
> > > *** 1659,1665 ****
> > >                   else
> > >                       rewritelog(r, 2, "[per-dir %s] prepare forced redirect %s -> %s", perdir, r->filename, newuri);
> > >                   r->filename = pstrdup(r->pool, newuri);
> > > -                 r->status = p->forced_responsecode;
> > >                   return 1;
> > >               }
> > >           }
> > > --- 1660,1665 ----
> > > 
> > > 
> > 
> 
> 


Re: [BUG] mod_rewrite and redirect code

Posted by Marc Slemko <ma...@worldgate.com>.
No, I skipped it because Ralf is including it in his patch which is, I
think, still awaiting votes.  Hint, hint.

On Sun, 13 Jul 1997, Dean Gaudet wrote:

> Did this go in?  PR#777 is still open.
> 
> Dean
> 
> On Sat, 5 Jul 1997, Marc Slemko wrote:
> 
> > The following rule:
> > 
> >     RewriteRule ^/~marcs/(.*) http://valis/~marcs/$1 [redirect=permanent]
> > 
> > still returns a 302 instead of a 301 like it should.  PR#777 is also about
> > this. 
> > 
> > The following patch fixes it, but I haven't really had the time to look
> > and see if it is correct.  Ralf?
> > 
> > Index: mod_rewrite.c
> > ===================================================================
> > RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
> > retrieving revision 1.31
> > diff -c -r1.31 mod_rewrite.c
> > *** mod_rewrite.c	1997/06/22 03:45:00	1.31
> > --- mod_rewrite.c	1997/07/05 19:53:34
> > ***************
> > *** 1624,1629 ****
> > --- 1624,1630 ----
> >              and the current URL still is not a fully qualified one we
> >              finally prefix it with http[s]://<ourname> explicitly */
> >           if (flags & RULEFLAG_FORCEREDIRECT) {
> > +             r->status = p->forced_responsecode;
> >               if (  !(strlen(r->filename) > 7 &&
> >                       strncmp(r->filename, "http://", 7) == 0)
> >                  && !(strlen(r->filename) > 8 &&
> > ***************
> > *** 1659,1665 ****
> >                   else
> >                       rewritelog(r, 2, "[per-dir %s] prepare forced redirect %s -> %s", perdir, r->filename, newuri);
> >                   r->filename = pstrdup(r->pool, newuri);
> > -                 r->status = p->forced_responsecode;
> >                   return 1;
> >               }
> >           }
> > --- 1660,1665 ----
> > 
> > 
> 


Re: [BUG] mod_rewrite and redirect code

Posted by Dean Gaudet <dg...@arctic.org>.
Did this go in?  PR#777 is still open.

Dean

On Sat, 5 Jul 1997, Marc Slemko wrote:

> The following rule:
> 
>     RewriteRule ^/~marcs/(.*) http://valis/~marcs/$1 [redirect=permanent]
> 
> still returns a 302 instead of a 301 like it should.  PR#777 is also about
> this. 
> 
> The following patch fixes it, but I haven't really had the time to look
> and see if it is correct.  Ralf?
> 
> Index: mod_rewrite.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
> retrieving revision 1.31
> diff -c -r1.31 mod_rewrite.c
> *** mod_rewrite.c	1997/06/22 03:45:00	1.31
> --- mod_rewrite.c	1997/07/05 19:53:34
> ***************
> *** 1624,1629 ****
> --- 1624,1630 ----
>              and the current URL still is not a fully qualified one we
>              finally prefix it with http[s]://<ourname> explicitly */
>           if (flags & RULEFLAG_FORCEREDIRECT) {
> +             r->status = p->forced_responsecode;
>               if (  !(strlen(r->filename) > 7 &&
>                       strncmp(r->filename, "http://", 7) == 0)
>                  && !(strlen(r->filename) > 8 &&
> ***************
> *** 1659,1665 ****
>                   else
>                       rewritelog(r, 2, "[per-dir %s] prepare forced redirect %s -> %s", perdir, r->filename, newuri);
>                   r->filename = pstrdup(r->pool, newuri);
> -                 r->status = p->forced_responsecode;
>                   return 1;
>               }
>           }
> --- 1660,1665 ----
> 
>