Forum OpenACS Development: Re: Improving Gatekeeper Package

Collapse
Posted by Nima Mazloumi on
I looked at the code and the following passage does all the rewriting of the pages:

ad_proc -private gatekeeper_subst_tag { page tag relative_url this_dir} {
    #Handle relative urls that start with ../ by translating them as if they were server rr
    regsub -nocase -all "(<\[^>]*\[ \n\t\]+$tag\[ \n\t\]*=\[ \n\t\]*\"?)\.\./(\[^> \n\t\]*)(\[> \n\t\])" $page "\\1$this_dir../\\2\\3" page

    regsub -nocase -all "(<\[^>]*\[ \n\t\]+$tag\[ \n\t\]*=\[ \n\t\]*\"?)/(\[^> \n\t\]*)(\[> \n\t\])" $page "\\1$relative_url\\2\\3" page
    return $page
}

I don't understand the part \[ \n\t\]. Any idea what this implies?

The $tag is "href", "src", "action" or "codebase".
The $page is the original content of the page.

So for instance the following url

http://<server>/<directory>/page.html

is rewritten to

http://<aolserver>/gatekeeper-path/sr//<directory>/page.html

I tested it with real pages but some links are broken.
Also the rewrite seems to have problems with pages that contain frames.
And last but not least I created two gatekeeper-instances, one for PHPMyAdmin and one for PHPPGAdmin (both PHP-applications ;)). While the last one displays at least the pages the first one asks me if I want to download the PHP-Pages. This seems to have something to do with the content-type, I guess.

Has someone had similiar experience with the package?

If we could fix this and extend the package by accept headers and footers and redirecting also cookies then we could create a single-sign-on mechanism for sites that work with cookies.

Greetings,
Nima