HTTP server data types. More...

Data Structures

struct  http_server_param_t
 HTTP GET/POST request parameter. More...
 
struct  http_server_header_t
 HTTP request header. More...
 
struct  http_server_dynamic_page_t
 Dynamic URL callback context. More...
 
struct  http_server_tls_client_t
 Information about connected TLS clients. More...
 

Typedefs

typedef void * http_server_request_t
 Internal HTTP server request context.
 
typedef zos_result_t(* http_server_request_processor_t) (const http_server_request_t *request, const char *arg)
 Dynamic URL callback prototype. More...
 
typedef zos_bool_t(* http_custom_header_callback_t) (const char *key, const char *value)
 Custom header processing callback prototype. More...
 
typedef zos_bool_t(* http_server_authorize_callback_t) (const char *username, const char *password)
 Authorize client credentials callback prototype. More...
 
typedef void(* http_server_not_found_callback_t) (const http_server_request_t *request)
 Requested URL not found callback prototype. More...
 

Enumerations

enum  http_server_header_flag_t {
  HTTP_SERVER_HEADER_NONE = 0,
  HTTP_SERVER_HEADER_GZIP = (1 << 0),
  HTTP_SERVER_HEADER_CACHE = (1 << 1)
}
 Additional HTTP response header flags used by zn_hs_write_reply_header() More...
 
enum  http_server_method_t {
  HTTP_METHOD_GET = 0,
  HTTP_METHOD_POST = 1,
  HTTP_METHOD_HEAD = 2,
  HTTP_METHOD_DELETE = 3,
  HTTP_METHOD_OPTIONS = 4,
  HTTP_METHOD_PUT = 5
}
 HTTP request methods. More...
 
enum  http_server_request_header_t {
  HTTP_REQUEST_USER_AGENT,
  HTTP_REQUEST_TRANSFER_ENCODING,
  HTTP_REQUEST_CONTENT_TYPE,
  HTTP_REQUEST_AUTHORIZATION,
  HTTP_REQUEST_WS_KEY,
  HTTP_REQUEST_CONTENT_LENGTH
}
 Default HTTP request header. More...
 

Detailed Description

HTTP server data types.

Typedef Documentation

typedef zos_bool_t(* http_custom_header_callback_t) (const char *key, const char *value)

Custom header processing callback prototype.

This callback is called when the HTTP request is being parsed. It called for each custom HTTP request header encountered.

Note
The callback executes in the HTTP server thread context
Parameters
[out]keyThe header key
[out]valueThe header value
Returns
ZOS_TRUE if header should be stored with request context, ZOS_FALSE else
typedef zos_bool_t(* http_server_authorize_callback_t) (const char *username, const char *password)

Authorize client credentials callback prototype.

If the HTTP request contain a 'Basic Authorization' header, this callback is called with the given username/password. This callback allows for denying unauthorized users.

Note
The callback executes in the HTTP server thread context
Parameters
[out]usernameSupplied username
[out]passwordSupplied password
Returns
ZOS_TRUE if user is authorized, ZOS_FALSE else
typedef void(* http_server_not_found_callback_t) (const http_server_request_t *request)

Requested URL not found callback prototype.

This callback is called when the request URL route is not found.

Note
The callback executes in the HTTP server thread context
Parameters
[out]requestInternal request context
typedef zos_result_t(* http_server_request_processor_t) (const http_server_request_t *request, const char *arg)

Dynamic URL callback prototype.

Note
The callback executes in the HTTP server thread context
Parameters
[out]requestPointer to internal request context
[out]argURL arguments (if callback was specified with 's' in URL)
Returns
zos_result_t result of processing request

Enumeration Type Documentation

Additional HTTP response header flags used by zn_hs_write_reply_header()

Enumerator
HTTP_SERVER_HEADER_NONE 

No additional response headers.

HTTP_SERVER_HEADER_GZIP 

Returned data is gzip compressed.

HTTP_SERVER_HEADER_CACHE 

Indicate that returned data/page should be cached (by default pages are NOT cached)

HTTP request methods.

Enumerator
HTTP_METHOD_GET 

HTTP_METHOD_GET.

HTTP_METHOD_POST 

HTTP_METHOD_POST.

HTTP_METHOD_HEAD 

HTTP_METHOD_HEAD.

HTTP_METHOD_DELETE 

HTTP_METHOD_DELETE.

HTTP_METHOD_OPTIONS 

HTTP_METHOD_OPTIONS.

HTTP_METHOD_PUT 

HTTP_METHOD_PUT.

Default HTTP request header.

By default the HTTP server will only store the following HTTTP request headers. To store custom headers use zn_hs_register_header_callback()

Enumerator
HTTP_REQUEST_USER_AGENT 

HTTP_REQUEST_USER_AGENT.

HTTP_REQUEST_TRANSFER_ENCODING 

HTTP_REQUEST_TRANSFER_ENCODING.

HTTP_REQUEST_CONTENT_TYPE 

HTTP_REQUEST_CONTENT_TYPE.

HTTP_REQUEST_AUTHORIZATION 

HTTP_REQUEST_AUTHORIZATION.

HTTP_REQUEST_WS_KEY 

HTTP_REQUEST_WS_KEY.

HTTP_REQUEST_CONTENT_LENGTH 

HTTP_REQUEST_CONTENT_LENGTH.