tcltrace::before-ns_return (private)
tcltrace::before-ns_return cmd op
Defined in packages/acs-tcl/tcl/tcltrace-procs.tcl
Execute this proc before ns_return is called. This proc saves the request in a file, which can be later used for validating the returned HTML. This works as well for admin pages, which can not be validated via web based HTML validators without giving away admin privileges.
- Parameters:
- cmd (required)
- the full command as executed by Tcl
- op (required)
- the trace operation
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: lassign $cmd cmdname statuscode mimetype content if {[::parameter::get_from_package_key -package_key acs-tcl -parameter TclTraceSaveNsReturn -default 0]} { if {$statuscode == 200 && $mimetype eq "text/html"} { set name [ns_conn url] regsub {/$} $name /index name set fullname [ad_tmpdir]/ns_saved$name.html ns_log notice "before-ns_return: save content of ns_return to file:$fullname" set dirname [ad_file dirname $fullname] if {![ad_file isdirectory $dirname]} { file mkdir $dirname } set f [open $fullname w] puts $f $content close $f } else { ns_log notice "before-ns_return: ignore statuscode $statuscode mime-type $mimetype" } }XQL Not present: Generic, PostgreSQL, Oracle