util::http::get (public)
util::http::get [ -url url ] [ -headers headers ] [ -timeout timeout ] \ [ -max_depth max_depth ] [ -force_ssl ] [ -gzip_response ] \ [ -spool ] [ -preference preference ]
Defined in packages/acs-tcl/tcl/http-client-procs.tcl
Issue an HTTP GET request to 'url'.
- Switches:
- -url (optional)
- -headers (optional)
- specifies an ns_set of extra headers to send to the server when doing the request. Some options exist that allow one to avoid the need to specify headers manually, but headers will always take precedence over options.
- -timeout (optional, defaults to
"30"
)- Timeout in seconds. The value can be an integer, a floating point number or an ns_time value.
- -max_depth (optional, defaults to
"10"
)- -force_ssl (optional, boolean)
- specifies whether we want to use SSL despite the url being in http:// form. Default behavior is to use SSL on https:// URLs only.
- -gzip_response (optional, boolean)
- informs the server that we are capable of receiving gzipped responses. If server complies to our indication, the result will be automatically decompressed.
- -spool (optional, boolean)
- enables file spooling of the request on the file specified. It is useful when we expect large responses from the server. The result is spooled to a temporary file, the name is returned in the file component of the result.
- -preference (optional, defaults to
"native curl"
)- decides which available implementation prefer in respective order. Choice is between 'native', based on ns_ api, available for NaviServer only and giving the best performances and 'curl', which wraps the command line utility (available on every system with curl installed).
- Returns:
- the data as dict with elements 'headers', 'page', 'file', 'status', 'time' (elapsed request time in ns_time format), and 'modified'.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- util_http_json_encoding, postman_echo