[Xitami] Small modification to ISAPI support
Russel Olinger
rolinger1 at hotmail.com
Wed Apr 30 18:30:52 CEST 2008
JLIST: Could you explain that a bit more? I get the gist of it but I
assume you are also compiling our own Xitami and are able to modify the
source. For us non-compiled users I am not certain we can use that method.
So instead, I do my own version of URL rewrites through Xitami's CGI
aliasing. It works just fine and still provides you with all the necessary
PATH_INFO and perl $ENV of the alias - not of the actual called script
Example:
/showArticle /cgi-bin/postShow.pl
A URL example would be:
http://www.foo.com/showArticle/cars/classic/1965-Convertable-Corvette_12345.html
/showArticle calls the "/cgi-bin/poswShow.pl" script, in the script I parse
the PATH_INFO environment variable to grab all the necessary ID info about
the URL to call up the correct article. In this case, "cars" and "classic"
translate to category and forum IDs, then grab the actual article ID "12345"
to call it up to the user. Using the CGI alias method, the PATH_INFO
environment variable is conveniently everything AFTER the /showArticle
alias.
So PATH_INFO = /cars/classic/1965-Convertable-Corvette_12345.html
Parse everything on "/" into an array: @array = split(/\//,$PATH_INFO)
SPLICE the first empty element: splice @array,
Then split the last element for the article ID, the text of irrelevant, its
only good for SEO stuff: @idInfo = split(/_/,$array[2]) ;
Remove the ".html" : $articleID = $idInfo[1] =~ s/\.html//;
Since I have never used Apache's mod_rewrite I don't know how much more
laborious the above method is...but its really not that difficult, each
script has to be slightly customized and you have to know what each part of
the URL stands for, but if you logically plan it out you can achieve the
whole thing pretty easy using just one called function to parse all your
vars for you. It also requires that for every script you want to do URL
rewrites on, you must add a unique CGI alias for it.
Hope it helps.
----- Original Message -----
From: "JLIST" <jlist9 at gmail.com>
To: <Xitami at lists.xitami.org>
Sent: Tuesday, April 29, 2008 11:34 PM
Subject: [Xitami] Small modification to ISAPI support
> Among other things, Xitami's lack of URL rewriting feature
> bothers me. So I made a couple of small changes to the ISAPI
> add-on, basically adding a -i/-I option to show index.dll. When
> no DLL file name is given in the URL, index.dll is used instead.
> This makes it possible to have URLs like http://domain/register,
> instead of http://domain/isapi_exe/register.dll
>
> 127a128
>> show_index = FALSE; /* Use index.dll if dll isn't
>> in url */
> 346a348,350
>> case 'I': /* Alway unload ON
>> */
>> case 'i':
>> show_index = TRUE; break;
> 599a604,605
>> static char index[] = "index.dll";
>>
> 608a615,617
>>
>> if (show_index && (!strstr(path_info, ".dll")))
>> path_info = index;
>
>
>
> --
> Xitami Users Mailing List -- For Xitami support
> To unsubscribe: http://lists.xitami.org/mailman/listinfo/xitami
>
More information about the Xitami
mailing list