httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Razvan Costea-Barlutiu <cbraz...@laitek.com>
Subject [users@httpd] mod_rewrite with external program
Date Fri, 10 Jan 2003 16:38:23 GMT
Hello--

I've set up a mod_rewrite engine mapped to an external program and I can't 
really make it work on my win2k box.

Below is the section of the httpd.conf dedicated to the rewrite. Basically, 
I want to rewrite any incoming URL, hence the rule (hope at least I got 
that right...)

RewriteEngine On
RewriteMap pramap prg:e:/_Archive/Source/_PRA_Apps/prarwrurl/prarwrurl_d.exe
RewriteRule ^.* ${pramap:$1}
RewriteLogLevel 9
RewriteLog e:/_Archive/Source/_PRA_Apps/prarwrurl/rewrite.log
RewriteLock	e:/_Archive/Source/_PRA_Apps/prarwrurl/rewritelock

The things is that the program starts, but it seems to be hanging the 
server, without reading anything from the stdin. The program is a plain C 
program and it doesn't do anything but printfing the input.
As soon as I kill the program, the server returns the 404 error.
I guess that this has something to do with RewriteLock and it seems that I 
just don't know how to use that (the same thing happens without the line in 
the CFG).

Below is the C source of the program.

int main(int argc, char *argv[])
{
	FILE* f = fopen("asa","wt"),*ff;
	char url[1024];
	while (1)
	{	if (ff = fopen("rewritelock","rt"))
		{	fprintf(f,"rewritelock opened");
			if (scanf("%s\n",url) != -1)
			{	fprintf(f,"URL received: %s\n",url);
				printf("http://localhost:1977");
			}
			fclose(ff);
		}
	}
	fclose(f);
	return 1;
}


Any help is much appreciated.
TIA,
--Razvan


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