You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sandeep Warikoo <wa...@gmail.com> on 2006/10/17 13:17:40 UTC
[users@httpd] Proglem with RewriteMap directive (mod_rewrite module)
Hi All,
I am facing a very strange problem with mod_rewrite module of Apache.
I am using an external program in perl to perform key-value mapping using
RewriteMap Directive.
I have a very simple program:
---------------------
#!/usr/bin/perl
$|=1;
$i = 1;
while($input = <STDIN>)
{
print "$i\n";
$i++;
}
-------------------------
And the RewriteRule is
RewriteLock /root/demo.pl
RewriteMap cvssvnrev prg:/root/demo.pl
RewriteCond %{QUERY_STRING} ^rev=(.*)$
RewriteRule /viewcvs/viewcvs.cgi/(.*)
http://10.88.152.75/viewvc/trunk/$1?rev=${cvssvnrev:$1+%1} [L]
This means that for first access to such url I should get "rev=1", for next
access "rev=2", and so on as query String. But
what I get is "rev=" for first access, "rev=1" for second access, "rev=2"
for third access, i.e. the value I get is the one that was
calculated during previous execution. It looks like the apache module after
writing to STDIN of this program doesn't wait for
newline termination output from program (which it should so as per
specification), but immediately reads whatever is on pipe
which is nothing for first execution, and output of previous executions for
rest of executions.
Is this a bug in mod_rewrite module (I am using Apache version 2.2)? Or
there is some option I have missed?
regards
Sandeep
Re: [users@httpd] Proglem with RewriteMap directive (mod_rewrite module)
Posted by Sandeep Warikoo <wa...@gmail.com>.
Hi Georgi,
Changed RewriteLock to some other file. Still the problem persists.
On 10/17/06, Georgi Chorbadzhiyski <gf...@unixsol.org> wrote:
>
> Sandeep Warikoo wrote:
> > I am facing a very strange problem with mod_rewrite module of Apache.
> > I am using an external program in perl to perform key-value mapping
> using
> > RewriteMap Directive.
> >
> > I have a very simple program:
> >
> > ---------------------
> > #!/usr/bin/perl
> >
> > $|=1;
> > $i = 1;
> >
> > while($input = <STDIN>)
> > {
> > print "$i\n";
> > $i++;
> > }
> > -------------------------
> >
> > And the RewriteRule is
> >
> > RewriteLock /root/demo.pl
>
> Are you sure this is correct? Try setting other LockFile than the script
> itself.
>
> > RewriteMap cvssvnrev prg:/root/demo.pl
> >
> > RewriteCond %{QUERY_STRING} ^rev=(.*)$
> > RewriteRule /viewcvs/viewcvs.cgi/(.*)
> > http://10.88.152.75/viewvc/trunk/$1?rev=${cvssvnrev:$1+%1} [L]
> >
> > This means that for first access to such url I should get "rev=1", for
> next
> > access "rev=2", and so on as query String. But
> >
> > what I get is "rev=" for first access, "rev=1" for second access,
> "rev=2"
> > for third access, i.e. the value I get is the one that was
> >
> > calculated during previous execution. It looks like the apache module
> after
> > writing to STDIN of this program doesn't wait for
> >
> > newline termination output from program (which it should so as per
> > specification), but immediately reads whatever is on pipe
> >
> > which is nothing for first execution, and output of previous executions
> for
> > rest of executions.
> >
> > Is this a bug in mod_rewrite module (I am using Apache version 2.2)? Or
> > there is some option I have missed?
>
> --
> Georgi Chorbadzhiyski
> http://georgi.unixsol.org/
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: [users@httpd] Proglem with RewriteMap directive (mod_rewrite
module)
Posted by Georgi Chorbadzhiyski <gf...@unixsol.org>.
Sandeep Warikoo wrote:
> I am facing a very strange problem with mod_rewrite module of Apache.
> I am using an external program in perl to perform key-value mapping using
> RewriteMap Directive.
>
> I have a very simple program:
>
> ---------------------
> #!/usr/bin/perl
>
> $|=1;
> $i = 1;
>
> while($input = <STDIN>)
> {
> print "$i\n";
> $i++;
> }
> -------------------------
>
> And the RewriteRule is
>
> RewriteLock /root/demo.pl
Are you sure this is correct? Try setting other LockFile than the script itself.
> RewriteMap cvssvnrev prg:/root/demo.pl
>
> RewriteCond %{QUERY_STRING} ^rev=(.*)$
> RewriteRule /viewcvs/viewcvs.cgi/(.*)
> http://10.88.152.75/viewvc/trunk/$1?rev=${cvssvnrev:$1+%1} [L]
>
> This means that for first access to such url I should get "rev=1", for next
> access "rev=2", and so on as query String. But
>
> what I get is "rev=" for first access, "rev=1" for second access, "rev=2"
> for third access, i.e. the value I get is the one that was
>
> calculated during previous execution. It looks like the apache module after
> writing to STDIN of this program doesn't wait for
>
> newline termination output from program (which it should so as per
> specification), but immediately reads whatever is on pipe
>
> which is nothing for first execution, and output of previous executions for
> rest of executions.
>
> Is this a bug in mod_rewrite module (I am using Apache version 2.2)? Or
> there is some option I have missed?
--
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org