PingAccess Agent SDK for C
Public Attributes | List of all members
paa_client_response_struct Struct Reference

#include <paa-http-server-facade.h>

Public Attributes

void * impl
 
int(* get_status )(const paa_client_response *resp)
 
apr_status_t(* set_header )(const paa_client_response *resp, const char *name, const char *value)
 
apr_status_t(* add_header )(const paa_client_response *resp, const char *name, const char *value)
 
apr_status_t(* remove_header )(const paa_client_response *resp, const char *name)
 
apr_status_t(* enumerate_headers )(const paa_client_response *resp, paa_header_cb cb, void *userdata)
 
apr_status_t(* replacing )(const paa_client_response *resp)
 
apr_status_t(* set_status )(const paa_client_response *resp, int status, const char *reason)
 
paa_client_response_write_cb(* get_write_cb )(const paa_client_response *resp)
 
void *(* get_write_data )(const paa_client_response *resp)
 

Detailed Description

The client response interface. This interface is implemented by a HTTP server/proxy to provide access to the HTTP response being served to a client

Member Data Documentation

apr_status_t(* paa_client_response_struct::add_header) (const paa_client_response *resp, const char *name, const char *value)

Adds a header to the client response.

The following algorithm should be used to add the header value to the client response:

  • If the header does not exist in the client response, add a new header field to the response with the specified name and value.
  • If the header does exist in the client response:
    • If the header is not named Set-Cookie, the implementation of this function is free to add a new header field with the specified name and value or append the value to the existing header field, separating the values with a comma.
    • If the header is named Set-Cookie, the value should be added as a new, distinct header field.
Parameters
respthe response handle
namethe name of the header
valuethe value of the header
Returns
APR_SUCCESS on success
apr_status_t(* paa_client_response_struct::enumerate_headers) (const paa_client_response *resp, paa_header_cb cb, void *userdata)

Enumerates all headers in the response, invoking the callback for each header value. Headers with multiple values can be passed to the callback in any acceptable format. For example, consider the following response header:

X-Custom-Header: value1, value2 X-Custom-Header: value3

Any of the following of sequences of invocations of the header callback would be acceptable:

cb("X-Custom-Header", "value1"); cb("X-Custom-Header", "value2"); cb("X-Custom-Header", "value3");

cb("X-Custom-Header", "value1, value2"); cb("X-Custom-Header", "value3");

cb("X-Custom-Header", "value1, value2, value3");

Note: this function will only be invoked on a modified client response (i.e., one in which add, set or remove header has been invoked) when the SDK log level is set to DEBUG.

Parameters
respthe handle
cbthe callback used to enumerate the headers
userdatathe userdata passed to the callback
Returns
APR_SUCCESS on success
int(* paa_client_response_struct::get_status) (const paa_client_response *resp)
Parameters
respthe handle
Returns
the status code set in the client response
paa_client_response_write_cb(* paa_client_response_struct::get_write_cb) (const paa_client_response *resp)

Note: this field can be safely set to NULL if the paa_http_client interface is not being utilized.

Parameters
respthe response handle
Returns
the function used to process the body from the agent response
void*(* paa_client_response_struct::get_write_data) (const paa_client_response *resp)

Note: this field can be safely set to NULL if the paa_http_client interface is not being utilized.

Parameters
respthe response handle
Returns
the data to be passed to the write callback
void* paa_client_response_struct::impl

opaque implementation handle

apr_status_t(* paa_client_response_struct::remove_header) (const paa_client_response *resp, const char *name)

Removes a header from the client response. All header values for the specified header name should be removed from the headers.

Parameters
respthe response handle
namethe name of the header
Returns
APR_SUCCESS on success
apr_status_t(* paa_client_response_struct::replacing) (const paa_client_response *resp)

Note: this field can be safely set to NULL if the paa_http_client interface is not being utilized.

Called to indicate that the paa_client_response is being set to the agent response. Implementers of paa_client_response can take this opportunity to prepare the client response for the modification operations that will follow the invocation of this function.

Parameters
respthe response handle
Returns
APR_SUCCESS on success
apr_status_t(* paa_client_response_struct::set_header) (const paa_client_response *resp, const char *name, const char *value)

Sets a header in the client response. The following algorithm should be used to set the header in the response:

1) Remove all headers in the response with name (case-insensitive comparison) 2) Set a single header in the response with name and value

For example, consider the following response header:

X-Custom: value1, value2
X-Custom: value3

If set_header is called with a name of "X-Custom" and a value of "value4", the following response header should result:

X-Custom: value4

Specifically, the values of value1, value2 and value3 are overridden in the response.

Parameters
respthe response handle
namethe name of the header
valuethe value of the header
Returns
APR_SUCCESS on success
apr_status_t(* paa_client_response_struct::set_status) (const paa_client_response *resp, int status, const char *reason)

Note: this field can be safely set to NULL if the paa_http_client interface is not being utilized.

Sets the status in the client response

Parameters
respthe response handle
statusthe status code
reasonthe reason string
Returns
APR_SUCCESS on success

The documentation for this struct was generated from the following file: