Index: openacs-4/packages/ecommerce/tcl/ecommerce-ssl-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-ssl-procs.tcl,v diff -u -r1.7.2.3 -r1.7.2.4 --- openacs-4/packages/ecommerce/tcl/ecommerce-ssl-procs.tcl 19 Dec 2004 11:26:18 -0000 1.7.2.3 +++ openacs-4/packages/ecommerce/tcl/ecommerce-ssl-procs.tcl 10 Apr 2005 20:20:27 -0000 1.7.2.4 @@ -70,12 +70,12 @@ } ad_proc ec_secure_location {} { - @return the secure location https://host:port, favoring the https module specified as an ecommerce parameter. + @returns the secure location https://host:port, favoring the https module specified as an ecommerce parameter. } { - # set loc [ad_parameter -package_id [ec_id] SecureLocation] + set loc [ad_parameter -package_id [ec_id] SecureLocation] if {[empty_string_p $loc] || [string equal -nocase $loc "No Value"]} { - # set sdriver [ad_parameter -package_id [ec_id] httpsModule] + set sdriver [ad_parameter -package_id [ec_id] httpsModule] if {[empty_string_p $sdriver]} { array set drivers [ec_preferred_drivers] @@ -88,8 +88,7 @@ set secure_port [ns_config -int "ns/server/[ns_info server]/module/$sdriver" ServerPort 443] } ### nsopenssl 3 has variable locations for the secure port - # This next check might best be handled by creating another - # parameter value for users/inboundssl (custom driver name) + # this is matched to the aolserver config.tcl if { [empty_string_p $secure_port] || [string match $secure_port 443] } { set secure_port [ns_config -int "ns/server/[ns_info server]/module/$sdriver/ssldriver/users" port 443] } @@ -194,7 +193,7 @@ # so that links from both /ecommerce-instance/ and # and /ecommerce-instance/admin work - set register_url "[ec_secure_location][ad_conn package_url]register/index?return_url=[ns_urlencode $secure_url]&http_id=$user_id&user_session_id=$user_session_id" + set register_url "[ec_securelink [ad_get_login_url]]?return_url=[ns_urlencode $secure_url]&http_id=$user_id&user_session_id=$user_session_id" ad_returnredirect $register_url template::adp_abort } @@ -227,8 +226,8 @@ return 0 } else { array set drivers [ec_preferred_drivers] - set secure_url "https://[ns_config ns/server/[ns_info server]/module/$drivers(sdriver) Hostname]" - set secure_port [ns_config ns/server/[ns_info server]/module/$drivers(sdriver) Port] + set secure_url "https://[ns_info hostname]" + set secure_port [ns_config ns/server/[ns_info server]/module/$drivers(sdriver) ServerPort] if ![empty_string_p $secure_port] { append secure_url ":$secure_port" } @@ -249,7 +248,7 @@ If the current url is secure, will redirect the user to the insecure version of this page. One disadvantage of this is the Netscape throws up a "the document you requested was - supposed to be secure" window. ec_insecureurl might be a + supposed to be secure" window. ec_insecurelink might be a better choice. } { @@ -275,7 +274,7 @@ ad_proc ec_securelink {new_page} { - Allows you to create a relative link to a secure page + Creates a url to a secure page from a relative url that may or may not be secure } { @@ -284,17 +283,12 @@ return $new_page } - if { [string match "nsssl" [ns_conn driver]] || - [string match "nsopenssl" [ns_conn driver]] } { - # we don't need to do anything + if { [string match "nsssl" [ns_conn driver]] || [string match "nsopenssl" [ns_conn driver]] } { + # we are already connected via ssl, no need to do anything return $new_page } else { - array set drivers [ec_preferred_drivers] - set new_url "https://[ns_config ns/server/[ns_info server]/module/$drivers(sdriver) Hostname]" - set port [ns_config ns/server/[ns_info server]/module/$drivers(sdriver) Port] - if {![empty_string_p $port] && ($port != 443)} { - append new_url ":$port" - } + + set new_url [ec_secure_location] if [string match /* $new_page] { append new_url $new_page @@ -309,17 +303,15 @@ ad_proc ec_insecurelink {new_page} { - Allows you to create a relative link from a secure page to an - insecure page + Creates a url from a possible secure page to an insecure page } { if {![ad_ssl_available_p]} { # we don't have ssl installed, so return the original URL return $new_page } - if {(![string match "nsssl" [ns_conn driver]] && - ![string match "nsopenssl" [ns_conn driver]])} { + if {(![string match "nsssl" [ns_conn driver]] && ![string match "nsopenssl" [ns_conn driver]])} { # We're not on a secure page, so this relative link is already # doing the right thing. return $new_page