Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


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

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


  • From: "Sandeep Warikoo" <warikoo.sandeep@xxxxxxxxx>
  • Subject: Re: [users@httpd] Proglem with RewriteMap directive (mod_rewrite module)
  • Date: Tue, 17 Oct 2006 17:53:47 +0530

------=_Part_121009_17649494.1161087827372
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

------=_Part_121009_17649494.1161087827372
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

------=_Part_121009_17649494.1161087827372--