[Xitami] Small modification to ISAPI support
JLIST
jlist9 at gmail.com
Wed Apr 30 21:07:01 CEST 2008
Hello Russel,
Sorr for not being clear. My change is for the ISAPI add-on listed
on the add-on page, not for xitami itself. Basically I need a high
performance mechanism to serve dynamic pages (so, no CGI) on Windows.
(I use FastCGI on Linux but that's not an option for Xitami.) I suppose
I'll need to use LRWP. I find that the ISAPI add-on allows me
to run ISAPI DLLs as LRWP and that ISAPI is easier to write than
a complete LRWP. I think I'll be writing some ISAPI DLLs instead.
But with the ISAPI add-on, it always shows the DLL name in the URL,
hence why my change to remove that.
I am new to xitami and I wasn't aware of CGI aliasing. Howerver,
it seems to work only for CGIs. I tried it with ISAPI add-on and
it didn't work. CGI aliasing doesn't really work the same way
URL rewriting does.
This didn't work:
/test -> /isapi_exe/testisapi.dll
URL rewriting (I use mod_rewrite on lighttpd on Linux) is more
generic and more flexible. You can specify a regular expression
to do the work (and more) that you described with the .pl CGI.
It works with all URLs (cgi, fastcgi, scgi, static files ...)
It also allows you to redirect all requests (/*) but some exceptions
(e.g. /images/*) to your app at, e.g. /myapp.
Jack
Wednesday, April 30, 2008, 9:30:52 AM, you wrote:
> 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.
More information about the Xitami
mailing list