[ Table Of Contents | Keyword Index ]

ns_http(n) 4.99 "NaviServer Built-in Commands"

NAME

ns_http - Simple HTTP client functionality

TABLE OF CONTENTS

    TABLE OF CONTENTS
    SYNOPSIS
    DESCRIPTION
    COMMANDS
    EXAMPLES
    SEE ALSO
    KEYWORDS

SYNOPSIS

ns_http cancel id
ns_http cleanup
ns_http list
ns_http queue ?-method M? ?-body B? ?-headers S? ?-timeout T?
ns_http wait ?-result var? ?-status var? ?-timeout t? ?-headers H? ?-elapsed var?

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