mod_rewrite: External RewriteMap program never gets input

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

 



I am attempting to use an external program in RewriteMap. It seems that no
matter what I do, data never makes it to my program. 

I'm on an Ubuntu 11.04 machine, running Apache 2.2.17.

My /etc/apache2/sites-available/mynewsite looks like this:
RewriteEngine On
RewriteLock "/var/run/rewrite-lock.lock"
RewriteMap rmsp "prg:/usr/local/bin/rmsp.py"

My .htaccess file looks like this:
RewriteEngine On
RewriteBase /
RewriteRule foo/([^/]*) /bar/${rmsp:$1}/feed [R=301,L]

rmsp.py:
#!/usr/bin/python -u

import sys
import logging
logging.basicConfig(filename='/home/user/vhost/log/rmsp.log',level=logging.DEBUG)
logging.debug('rmsp started.')

while True:
    logging.debug('Waiting for input...')
    data = sys.stdin.readline()
    logging.debug('Data recieved: %s' % data )
    if data:
        logging.debug('printing: %s' % data )
        print data,
        sys.stdout.flush()
    else:
        logging.debug('eof. Breaking...')
        break

When I look at the log, I see:
DEBUG:root:rmsp started.
DEBUG:root:Waiting for input...

So, for some reason, my program is never getting any data. When I turn on
Rewrite logging, I don't see the "map lookup OK: map=rmsp key=stuff ->
val=stuff". It just does this:

10.1.10.14 - - [24/Jun/2011:13:11:17 --0600]
[mytestmachine.mikerocks.com/sid#7f9c98c36760][rid#7f9c98ed6fb0/initial] (3)
[perdir /home/user/vhost/] applying pattern 'foo/([^/]*)' to uri
'foo/ilovekittens'
10.1.10.14 - - [24/Jun/2011:13:11:17 --0600]
[mytestmachine.mikerocks.com/sid#7f9c98c36760][rid#7f9c98ed6fb0/initial] (2)
[perdir /home/user/vhost/] rewrite 'tag/ilovekittens' -> '/bar//feed'
10.1.10.14 - - [24/Jun/2011:13:11:17 --0600]
[mytestmachine.mikerocks.com/sid#7f9c98c36760][rid#7f9c98ed6fb0/initial] (2)
[perdir /home/user/vhost/] explicitly forcing redirect with
http://mytestmachine.mikerocks.com/tag//feed

I've tried using the internal function "int" mapping, and that works.

Any ideas on what I'm doing wrong? Is there other information that is
important/helpful?

-- 
View this message in context: http://old.nabble.com/mod_rewrite%3A-External-RewriteMap-program-never-gets-input-tp31923146p31923146.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[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