util::request_info (public)

 util::request_info [ -with_headers ]

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

Produce a string containing the detailed request information. This is in particular useful for debugging, when errors are raised.

Switches:
-with_headers (optional, boolean, defaults to "false")
Include request headers
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 Object ::boomerang::handler Object ::boomerang::handler (public) util::request_info util::request_info Object ::boomerang::handler->util::request_info ad_log ad_log (public) ad_log->util::request_info boomerang::handler proc record boomerang::handler proc record (public) boomerang::handler proc record->util::request_info util::block_request util::block_request (public) util::block_request->util::request_info util::suspicious_query_variable util::suspicious_query_variable (public) util::suspicious_query_variable->util::request_info ad_conn ad_conn (public) util::request_info->ad_conn util::get_referrer util::get_referrer (public) util::request_info->util::get_referrer util::ns_set_pretty_print util::ns_set_pretty_print (private) util::request_info->util::ns_set_pretty_print util_current_location util_current_location (public) util::request_info->util_current_location

Testcases:
No testcase defined.
Source code:
    set info ""
    if {[ns_conn isconnected]} {
        #
        # Base information
        #
        append info "    "  [ns_conn method]  " [util_current_location][ns_conn url]?[ns_conn query]"  " referred by '[get_referrer]' peer [ad_conn peeraddr] user_id [ad_conn user_id]"

        if {[ns_conn method] eq "POST"} {
            #
            # POST data info
            #
            if {[ns_conn flags] & 1} {
                append info "\n    connection already closed, cooked form-content:"
                foreach {k v} [ns_set array [ns_getform]] {
                    if {[string length $v] > 100} {
                        set v "[string range $v 0 100]..."
                    }
                    append info "\n        $k: $v"
                }
            } else {
                set ct [ns_set iget [ns_conn headers] content-type]
                if {[string match text/* $ct] || $ct eq "application/x-www-form-urlencoded"} {
                    set data [ns_conn content]
                    if {[string length $data] < 2000} {
                        append info "\n        post-data: $data"
                    }
                }
            }
        }

        #
        # Optional header info
        #
        if {$with_headers_p} {
            append info \n [util::ns_set_pretty_print [ns_conn headers]]
        }
    }
    return $info
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: