I am trying to use ns_http with an https uri and finding that the -timeout
seems not to work if the host does not exist. I get
ssl connect failed: error:00000000:lib(0):func(0):reason(0)
When I run it with a short timeout against an existing server I see:
seattle-vm-1-0:nscp 1> catch [http_post https://someserver.com "" [list
Content-type text/html" GET]] err
ns_http failed: timeout
When I run it with a short timeout against a server with a DNS entry but no
actual listener I see the ssl connect failed error.
Is there any way for the timeout to include the ssl handshake?
Here's my proc fyi:
proc http_post {hostname post_data {headerlist {Content-type
application/x-www-form-urlencoded}} {method POST}} {
# Simple script to stop using curl
# arguments are
# hostname: URI to connect to
# post_data: url encoded post data stuck together with ampersands
like a GET
# headers: optional list of header names and value (Optional defaults
to post header)
# method: POST or GET. LOL bad proc name (Optional defaults to POST)
# returns
# the data returned
set queryHeaders [ns_set create]
set replyHeaders [ns_set create]
foreach {key value} $headerlist {
ns_set put $queryHeaders $key $value
}
set h [ns_http queue -method $method -timeout 1:0 -headers
$queryHeaders -body $post_data $hostname]
ns_http wait -elapsed E -timeout 1:0 -result returnval -headers
$replyHeaders -status S $h
ns_log notice "[lindex [info level 0] 0] status code: $S elapsed:
$E"
ns_log notice "[lindex [info level 0] 0]reply: $returnval"
return $returnval
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel