[users@httpd] Proglem with RewriteMap directive (mod_rewrite module)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux