SecureRequest

From Pickwiki
Jump to: navigation, search

createSecureRequest UniVerse BASIC manual, release 10.0, page 11-179ff

Syntax

createSecureRequest(URL, http_method, request_handle, security_context)

Description

The createSecureRequest function behaves exactly the same as the createRequest() function, except for the fourth parameter, a handle to a security context, which is used to associate the security context with the request. If the URL does not start with “https” then the parameter is ignored. If the URL starts with “https” but an invalid context handle or no handle is provided, the function will abort and return with an error status.

Parameters

The following table describes each parameter of the syntax.

Parameter        Description
=========        ===========
URL              A string containing the URL for a resource on a web server. An
                 accepted URL must follow the specified syntax defined in RFC
                 1738. The general format is:
                 http://<host>:<port>/<path>?<searchpart>. 
                 The host can be either a name string or IP address. The port is 
                 the port number to connect to, which usually defaults to 80 and 
                 is often omitted, along with the pre-ceding colon. The path tells 
                 the web server which file you want, and, if omitted, means “home
                 page” for the system. The searchpart can be used to send additional 
                 information to a web server.
http_method      A string which indicates the method to be performed on the resource. 
request_handle   A handle to the request object.
securityContext  A handle to the security context (see create[[SecurityContext]] function).

The following table describes the status of each return code.

Return Code      Status
===========      ======
     0           Success.
     1           Invalid URL (Syntactically).
     2           Invalid method (For HTTP 1.0, only GET[[/POST/HEAD]])


Note: If URL does include a searchpart, it must be in its encoded format (space is converted into +, and other non-alphanumeric characters are converted into %HH format. See addRequestParameter() for more details). However, host and path are allowed to have these “unsafe” characters. UniVerse BASIC will encode them before communicating with the web server.