rp_handle_request (private)
rp_handle_request
Defined in packages/acs-tcl/tcl/request-processor-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set startclicks [clock clicks -microseconds] if { [rp_performance_mode] } { set current_url [ad_conn url] if {[info exists ::tcl_url2file($current_url)] && [info exists ::tcl_url2path_info($current_url)] } { ad_conn -set file $::tcl_url2file($current_url) ad_conn -set path_info $::tcl_url2path_info($current_url) rp_serve_concrete_file $::tcl_url2file($current_url) return } rp_debug "performance mode: no ::tcl_url2file mapping for $current_url available; perform usual lookup" } set resolve_values $::acs::pageroot[string trimright [ad_conn package_url] /] if {[ad_conn package_key] ne ""} { # # Only in cases where the URL refers to a mounted package, # include it for path checking. # lappend resolve_values {*}[apm_package_url_resolution [ad_conn package_key]] } foreach resolve_value $resolve_values { lassign $resolve_value root match_prefix set extra_url [ad_conn extra_url] rp_debug "rp_handle_request: getting extra_url <$extra_url>" if { $match_prefix ne "" } { if { [string first $match_prefix $extra_url] == 0 } { # # An empty "root" indicates we should reject the # attempted reference. This is used to block # references to embedded package [sitewide-]admin # pages that avoid the request processor permission # check. # if { $root eq "" } { break } set extra_url [string trimleft [string range $extra_url [string length $match_prefix] end] /] } else { continue } } ds_add rp [list notice "Trying rp_serve_abstract_file $root/$extra_url" $startclicks [clock clicks -microseconds]] ad_try { rp_serve_abstract_file "$root/$extra_url" set ::tcl_url2file([ad_conn url]) [ad_conn file] set ::tcl_url2path_info([ad_conn url]) [ad_conn path_info] } trap {AD EXCEPTION notfound} {val} { # # The file was not found so far. # #ns_log notice "rp_handle_request: AD_TRY NOTFOUND <$val> URL <$root/$extra_url>" ds_add rp [list notice "File $root/$extra_url: Not found" $startclicks [clock clicks -microseconds]] ds_add rp [list transformation [list notfound "$root / $extra_url" $val] $startclicks [clock clicks -microseconds]] continue } trap {AD EXCEPTION redirect} {url} { # # We have to redirect. # #ns_log notice "rp_handle_request: AD_TRY redirect $url" ds_add rp [list notice "File $root/$extra_url: Redirect" $startclicks [clock clicks -microseconds]] ds_add rp [list transformation [list redirect $root/$extra_url $url] $startclicks [clock clicks -microseconds]] ad_returnredirect $url } trap {AD EXCEPTION directory} {dir_index} { #ns_log notice "rp_handle_request: AD_TRY directory $dir_index" ds_add rp [list notice "File $root/$extra_url: Directory index" $startclicks [clock clicks -microseconds]] ds_add rp [list transformation [list directory $root/$extra_url $dir_index] $startclicks [clock clicks -microseconds]] continue } return } if {[info exists dir_index] && ![string match "*/CVS/*" $dir_index] } { if { [nsv_get rp_directory_listing_p .] } { set title "Directory listing of [ad_conn url]" set context [ad_conn url] set body [rp_html_directory_listing $dir_index] # # Provide a simple template to use the master templates # set code [template::adp_compile -string { <master> <property name="doc(title)">@title;literal@</property> <property name="context">@context;literal@</property> @body;noquote@ }] # # Do the remaining OpenACS ADP magic # append code { if { [info exists __adp_master] } { set __adp_output [template::adp_parse $__adp_master [concat [list __adp_slave $__adp_output] [array get __adp_properties]]] } } set __adp_stub "" ns_return 200 text/html [template::adp_eval code] return } } # OK, we didn't find a normal file. Let's look for a path info style thingy, # visiting possible file matches from most specific to least. foreach prefix [rp_path_prefixes $extra_url] { foreach resolve_value $resolve_values { lassign $resolve_value root match_prefix set extra_url [ad_conn extra_url] if { $match_prefix ne "" } { if { [string first $match_prefix $extra_url] == 0 } { set extra_url [string trimleft [string range $extra_url [string length $match_prefix] end] /] } else { continue } } ad_try { ad_conn -set path_info [string range $extra_url [string length $prefix]-1 end] rp_serve_abstract_file -noredirect -nodirectory -extension_pattern ".vuh" $root$prefix set ::tcl_url2file([ad_conn url]) [ad_conn file] set ::tcl_url2path_info([ad_conn url]) [ad_conn path_info] } trap {AD EXCEPTION notfound} {val} { ds_add rp [list transformation [list notfound $root$prefix $val] $startclicks [clock clicks -microseconds]] continue } trap {AD EXCEPTION redirect} {url} { ds_add rp [list transformation [list redirect $root$prefix $url] $startclicks [clock clicks -microseconds]] ad_returnredirect $url } trap {AD EXCEPTION directory} {dir_index} { ds_add rp [list transformation [list directory $root$prefix $dir_index] $startclicks [clock clicks -microseconds]] continue } return } } ds_add rp [list transformation [list notfound $root/$extra_url notfound] $startclicks [clock clicks -microseconds]] rp_debug "call ns_returnnotfound extra_url '$extra_url'" ns_returnnotfoundXQL Not present: Generic, PostgreSQL, Oracle