Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » SQL Anywhere Server - SQL Reference » Using SQL » SQL functions » Alphabetical list of functions

 

HTTP_HEADER function [HTTP]

Gets the value of an HTTP header.

Syntax
HTTP_HEADER( header-field-name )
Parameters
  • header-field-name   The name of an HTTP header field.

Remarks

This function returns the value of the named HTTP header field, or NULL if not called from an HTTP service. It is used when processing an HTTP request via a web service.

If a header for the given header-field-name does not exist, the return value is NULL. The return value is also NULL when the function is not called from a web service.

Some headers that may be of interest when processing an HTTP web service request include the following. More information about these headers is available at [external link] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html.org/Protocols/rfc2616/rfc2616-sec14.html.

  • Cookie   The cookie value(s), if any, stored by the client, that are associated with the requested URI.

  • Referer   The URL of the page that contained the link to the requested URI.

  • Host   The name or IP of the host that submitted the request.

  • User-Agent   The name of the client application.

  • Accept-Encoding   A list of encodings for the response that are acceptable to the client application.

These special headers are always defined when processing an HTTP web service request:

  • @HttpMethod   Returns the type of request being processed. Possible values include HEAD, GET, or POST.

  • @HttpURI   The full URI of the request, as it was specified in the HTTP request.

  • @HttpVersion   The HTTP version of the request (for example, 1.0, or 1.1).

These special headers allow access to the first line of a client request (also known as the request line).

See also
Standards and compatibility
  • SQL/2003   Vendor extension.

Example

The following example gets the Cookie header value:

SET cookie_value = HTTP_HEADER( 'Cookie' );

The following example returns the value of the first HTTP header.

DECLARE header_name LONG VARCHAR;
DECLARE header_value LONG VARCHAR;
SET header_name = NEXT_HTTP_HEADER( NULL );
SET header_value = HTTP_HEADER( header_name );