httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Othmar Pasteka <past...@kabsi.at>
Subject [users@httpd] Problems calling scripts in RewriteMap
Date Wed, 17 Dec 2003 23:03:28 GMT
Hi,

I have been now trying RewriteMap for all day long and didn't get
it working, maybe I am missing something obvious but I have read
the documentation several times now and I still don't know
anything more in how to get it working. My config:

RewriteEngine on
RewriteMap    session-check         prg:/var/www/session-check.py
RewriteRule   (^.+$)       ${session-check:$1}
RewriteLog /var/log/apache/rewrite.log
RewriteLogLevel 9

All I want to do is that whenever some site is tried to be viewed
it should go trhough session-check.py (or .php or .pl) should
check on the parameters if it's valid and well return two
different urls based on that.
In theory it shouldn't be a problem but for my apache
1.3.26-0woody3 (hence on debian woody) it doesn't work. whatever
I try it doesn't. I always get "400 Bad Request" sent back and I
have no clue why so :(.

The for scripts I tried and which all failed are (for which I
need the php one to get working so that's for me the most
important):

#!/usr/bin/env python -u

import sys

for line in sys.stdin():
        sys.stdout.write(line)
        sys.stdout.flush()


#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
    # ...put here any transformations or lookups...
            print $_;
	}


<?php
        $stdin = fopen('php://stdin', 'r');
        $stdout = fopen('php://stdout', 'w');
        $input_url = fgets($stdin, 3000);
	// also tried: fwrite($stdout,$input_url);
        fwrite($stdout,"/errorbh/");
        fclose($stdout);
	fclose($stdin);
?>


the logfiles usually look like the following. in the case of the
logfile snippet I had just " (/errorbh/index_corr.php) " as the pattern
in there but it wouldn't help much :(.

1.2.3.4 - - [17/Dec/2003:23:59:17 +0100] [foo.bar.com/sid#80a100c][r
id#81031f4/initial] (2) init rewrite engine with requested uri /errorbh/index_co
rr.php
1.2.3.4 - - [17/Dec/2003:23:59:17 +0100] [foo.bar.com/sid#80a100c][r
id#81031f4/initial] (3) applying pattern '(^.+$)' to uri '/errorbh/index_corr.ph
p'
1.2.3.4 - - [17/Dec/2003:23:59:17 +0100] [foo.bar.com/sid#80a100c][r
id#81031f4/initial] (5) map lookup OK: map=session-check key=/errorbh/index_corr
.php -> val=
1.2.3.4 - - [17/Dec/2003:23:59:17 +0100] [foo.bar.com/sid#80a100c][r
id#81031f4/initial] (2) rewrite /errorbh/index_corr.php -> 
1.2.3.4 - - [17/Dec/2003:23:59:17 +0100] [foo.bar.com/sid#80a100c][r
id#81031f4/initial] (2) local path result: 


So if someone does know where my problem is or how to get it
working, please don't hesitate to answer me! :)

TIA
Othmar 

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


Mime
View raw message