xmlrpc::httppost (private)
xmlrpc::httppost [ -url url ] [ -timeout timeout ] [ -depth depth ] \ [ -content content ]
Defined in packages/xml-rpc/tcl/xml-rpc-procs.tcl
The proc util_httppost doesn't work for our needs. We need to send Content-type of text/xml and we need to send a Host header. So, roll our own XML-RPC HTTP POST. Wait - lars-blogger sends out XML-RPC pings to weblogs.com. I'll steal the POST code from there and simplify that call.
- Switches:
- -url (optional)
- -timeout (optional, defaults to
"30"
)- -depth (optional, defaults to
"0"
)- -content (optional)
- Author:
- Vinod Kurup
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {[incr depth] > 10} { return -code error "xmlrpc::httppost: Recursive redirection: $url" } set req_hdrs [ns_set create] # headers necessary for a post and the form variables ns_set put $req_hdrs Accept "*/*" ns_set put $req_hdrs User-Agent "[ns_info name]-Tcl/[ns_info version]" ns_set put $req_hdrs "Content-type" "text/xml" ns_set put $req_hdrs "Content-length" [string length $content] set r [util::http::post -body $content -url $url -headers $req_hdrs] set headers [dict get $r headers] set status [dict get $r status] # follow 302 if {$status == 302} { set location [expr {[dict exists $headers location] ? [dict get $headers location] : ""}] if {$location ne ""} { ns_set free $headers close $rfd set page [xmlrpc::httppost -url $location -timeout $timeout -depth $depth -content $content] } } return [dict get $r page]XQL Not present: Generic, PostgreSQL, Oracle