NaviServer - programmable web server


[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_http(n) 4.99.3 naviserver "NaviServer Built-in Commands"

Name

ns_http - Simple HTTP client functionality

Table Of Contents

Synopsis

Description

This command provides a simple HTTP client mechanism.

COMMANDS

ns_http cancel id

Cancel quueued http request by id

ns_http cleanup

Cancel all pending http requests

ns_http list

Return the list of currently running or pending requests in format: id url done|running ....

ns_http queue ?-method M? ?-body B? ?-headers S? ?-timeout T?

-timeout Timeout for how long to wait reply back from the web server -method GET or POST or HEAD -body body is the value which will be sent as the HTTP request body.

-headers headers is the ns_set ID containing the additional headers to include in the HTTP request.

ns_http wait ?-result var? ?-status var? ?-timeout t? ?-headers H? ?-elapsed var?

-elapsed var is the name of a variable that should be used to store the elapsed time for the request from beginning to finish

-result var is the name of a variable that should be used to store the HTTP response body.

-status var is the name of a variable that should be used to store the HTTP response status

-timeout Default timeout is "2:0" (2s, 0usec).

-headers headers is the ns_set ID which will receive the headers from the HTTP response.

EXAMPLES

 % ns_http queue http://www.google.com
 % http0
 % ns_http wait -status status -result result http0
 % 1

See Also

nsd

Keywords

ns_httpopen