Forum OpenACS Development: Re: rp_handler and host-node mapped subsites

Collapse
Posted by Torben Brosten on

Ryan, Eduardo,

I agree, openacs-core things break in host-node mapped sites. Many times, it's because a package is limited to a single mount, often outside of the host node mapped file hierarchy. These should be re-worked to handle more general cases.

I guess what I'm saying is that the rp_handler is not the place to be throwing form posts. Use it to generate urls that work in the first place.

Most apps reside within a single directory. By omitting all forward slashes, browsers use existing directories. The case is simple for all these host node map directories.. no change required. For example, take a look at birdswelcome.com All the forms in that site use post. All are in a single directory. No issues, even when accessing via dekkasupply.com/birdswelcome

For apps that require processing between a hostnode-mapped domain and the main-domain, such as login and register, build the post and return_url ahead of time using absolute references.

site_node::conn_url is helpful. It is especially useful in a place like index.vuh in a hostnode-mapped directory.

Here's an example from universallogos.com/index.vuh

set conn_url [site_node::conn_url]
set conn_url0 [ad_conn url]
ns_log Notice "/www/universallogos/index.vuh conn_url = '${conn_url}', ad_conn url = ${conn_url0}"
if { $conn_url eq "" } {
    regsub -- {/universallogos/} $conn_url0 {/} conn_url
}

if { [string match "/resources/*" $conn_url ] } {
    set redirect_url "/www${conn_url}"
    rp_internal_redirect $redirect_url
    ad_script_abort
} elseif { [string match "/search/*" $conn_url ] } {
    set query [ns_conn query]
    set redirect_url "http://dekkasupply.com${conn_url}?${query}"
  ns_log Notice "/usr/local/www/dekkasupply.com.com/openacs-4/www/universallogos/index.vuh: redirecting to: ${redirect_url}"
    ad_returnredirect -allow_complete_url $redirect_url
    ad_script_abort

} else {

    ::xowiki::Package initialize -ad_doc { 
 
        The script uses an XoWiki page as root page 
        of the site. Here, the start page is /xowiki/ followed 
        by the actual URL, as specified as the value after "-url" below. 
        Replace this value, in case a different XoWiki instance 
        name should be used. 
   
        @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) 
        @creation-date July, 2006 
        @cvs-id $Id: index.vuh,v 1.5 2006/09/15 16:45:00 gustafn Exp $  
    } -parameter { 
        {-m view} 
        {-folder_id:integer 0} 
    } -url /universallogos/xowiki${conn_url}

    ::$package_id reply_to_user [::$package_id invoke -method $m] 
    ad_script_abort 
}

cheers,
Torben

Collapse
Posted by Ryan Gallimore on
I see your point, Torben. But not all POSTs are made to the same directory. See my permissions example above.

The problem, as Eduardo pointed out, lies with when to set ad_conn url, and the hack for mapped subsites that is already in place in rp_filter.

# 2. handle special case: if the root is a prefix of the URL,
# remove this prefix from the URL, and redirect.

Collapse
Posted by Torben Brosten on
Ryan,

Perhaps you missed the second point in that post.

It begins with: "For apps that require processing between a hostnode-mapped domain and the main-domain"..

Also, see my previous post to Eduardo regarding building return_url in ad_get_login_url.

You should be able to build a proc that returns the absolute reference you need, without messing with the request processor or redirecting.

Are you trying to hide a form processing url from the web? If so, put the form processing in an index.vuh page. No redirect required.

Collapse
Posted by Eduardo Santos on
Hi Torben,

Thanks for the reply. I understand your suggestion and I've implemented it sometimes. However, it's an workaround and it doesn't solve the real problem.

The case is: you should point an URL to /subsite/page and it should just work on host node maped subsite. Try to map all the places in the system where this call appears is very difficult, and it can always lead to some fail.

Take a look at this link: http://fisheye.openacs.org/browse/OpenACS/openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl?r=1.105#to542

Somebody knew about this problem and fixed it for GET requests, but it stays for POST requests.

As you can see, ad_conn -set comes a little bit later: http://fisheye.openacs.org/browse/OpenACS/openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl?r=1.105#to631

I've tried a lot of different patches without success. What I've been doing until know is try to fix the symptom, not the disease. I would like very much to see a real fix for this problem, but I couldn't find any yet.