Apache2
md_http.h File Reference

Go to the source code of this file.

Data Structures

struct  md_http_callbacks_t
 
struct  md_http_timeouts_t
 
struct  md_http_request_t
 
struct  md_http_response_t
 
struct  md_http_impl_t
 

Typedefs

typedef struct md_http_t md_http_t
 
typedef struct md_http_request_t md_http_request_t
 
typedef struct md_http_response_t md_http_response_t
 
typedef apr_status_t md_http_status_cb(const md_http_request_t *req, apr_status_t status, void *data)
 
typedef apr_status_t md_http_response_cb(const md_http_response_t *res, void *data)
 
typedef struct md_http_callbacks_t md_http_callbacks_t
 
typedef struct md_http_timeouts_t md_http_timeouts_t
 
typedef apr_status_t md_http_next_req(md_http_request_t **preq, void *baton, md_http_t *http, int in_flight)
 
typedef apr_status_t md_http_init_cb(void)
 
typedef void md_http_cleanup_cb(md_http_t *req, apr_pool_t *p)
 
typedef void md_http_req_cleanup_cb(md_http_request_t *req)
 
typedef apr_status_t md_http_perform_cb(md_http_request_t *req)
 
typedef apr_status_t md_http_multi_perform_cb(md_http_t *http, apr_pool_t *p, md_http_next_req *nextreq, void *baton)
 
typedef struct md_http_impl_t md_http_impl_t
 

Functions

apr_status_t md_http_create (md_http_t **phttp, apr_pool_t *p, const char *user_agent, const char *proxy_url)
 
void md_http_set_response_limit (md_http_t *http, apr_off_t resp_limit)
 
apr_status_t md_http_clone (md_http_t **phttp, apr_pool_t *p, md_http_t *source_http)
 
void md_http_set_timeout_default (md_http_t *http, apr_time_t timeout)
 
void md_http_set_timeout (md_http_request_t *req, apr_time_t timeout)
 
void md_http_set_connect_timeout_default (md_http_t *http, apr_time_t timeout)
 
void md_http_set_connect_timeout (md_http_request_t *req, apr_time_t timeout)
 
void md_http_set_stalling_default (md_http_t *http, long bytes_per_sec, apr_time_t timeout)
 
void md_http_set_stalling (md_http_request_t *req, long bytes_per_sec, apr_time_t timeout)
 
void md_http_set_ca_file (md_http_t *http, const char *ca_file)
 
void md_http_set_unix_socket_path (md_http_t *http, const char *path)
 
apr_status_t md_http_perform (md_http_request_t *request)
 
void md_http_set_on_status_cb (md_http_request_t *req, md_http_status_cb *cb, void *baton)
 
void md_http_set_on_response_cb (md_http_request_t *req, md_http_response_cb *cb, void *baton)
 
apr_status_t md_http_GET_create (md_http_request_t **preq, md_http_t *http, const char *url, struct apr_table_t *headers)
 
apr_status_t md_http_HEAD_create (md_http_request_t **preq, md_http_t *http, const char *url, struct apr_table_t *headers)
 
apr_status_t md_http_POST_create (md_http_request_t **preq, md_http_t *http, const char *url, struct apr_table_t *headers, const char *content_type, struct apr_bucket_brigade *body, int detect_len)
 
apr_status_t md_http_POSTd_create (md_http_request_t **preq, md_http_t *http, const char *url, struct apr_table_t *headers, const char *content_type, const struct md_data_t *body)
 
apr_status_t md_http_GET_perform (md_http_t *http, const char *url, struct apr_table_t *headers, md_http_response_cb *cb, void *baton)
 
apr_status_t md_http_HEAD_perform (md_http_t *http, const char *url, struct apr_table_t *headers, md_http_response_cb *cb, void *baton)
 
apr_status_t md_http_POST_perform (md_http_t *http, const char *url, struct apr_table_t *headers, const char *content_type, struct apr_bucket_brigade *body, int detect_len, md_http_response_cb *cb, void *baton)
 
apr_status_t md_http_POSTd_perform (md_http_t *http, const char *url, struct apr_table_t *headers, const char *content_type, const struct md_data_t *body, md_http_response_cb *cb, void *baton)
 
void md_http_req_destroy (md_http_request_t *req)
 
apr_status_t md_http_multi_perform (md_http_t *http, md_http_next_req *nextreq, void *baton)
 
void md_http_use_implementation (md_http_impl_t *impl)
 
void md_http_set_impl_data (md_http_t *http, void *data)
 
void * md_http_get_impl_data (md_http_t *http)
 

Typedef Documentation

◆ md_http_callbacks_t

◆ md_http_cleanup_cb

typedef void md_http_cleanup_cb(md_http_t *req, apr_pool_t *p)

◆ md_http_impl_t

◆ md_http_init_cb

typedef apr_status_t md_http_init_cb(void)

◆ md_http_multi_perform_cb

typedef apr_status_t md_http_multi_perform_cb(md_http_t *http, apr_pool_t *p, md_http_next_req *nextreq, void *baton)

◆ md_http_next_req

typedef apr_status_t md_http_next_req(md_http_request_t **preq, void *baton, md_http_t *http, int in_flight)

Return the next request for processing on APR_SUCCESS. Return ARP_ENOENT when no request is available. Anything else is an error.

◆ md_http_perform_cb

typedef apr_status_t md_http_perform_cb(md_http_request_t *req)

◆ md_http_req_cleanup_cb

typedef void md_http_req_cleanup_cb(md_http_request_t *req)

◆ md_http_request_t

◆ md_http_response_cb

typedef apr_status_t md_http_response_cb(const md_http_response_t *res, void *data)

Callback invoked when the complete response has been received.

◆ md_http_response_t

◆ md_http_status_cb

typedef apr_status_t md_http_status_cb(const md_http_request_t *req, apr_status_t status, void *data)

Callback invoked once per request, either when an error was encountered or when everything succeeded and the request is about to be released. Only in the last case will the status be APR_SUCCESS.

◆ md_http_t

typedef struct md_http_t md_http_t

◆ md_http_timeouts_t

Function Documentation

◆ md_http_clone()

apr_status_t md_http_clone ( md_http_t **  phttp,
apr_pool_t p,
md_http_t source_http 
)

Clone a http instance, inheriting all settings from source_http. The cloned instance is not tied in any way to the source.

◆ md_http_create()

apr_status_t md_http_create ( md_http_t **  phttp,
apr_pool_t p,
const char *  user_agent,
const char *  proxy_url 
)

◆ md_http_GET_create()

apr_status_t md_http_GET_create ( md_http_request_t **  preq,
md_http_t http,
const char *  url,
struct apr_table_t headers 
)

Create a GET request.

Parameters
preqthe created request after success
httpthe md_http instance
urlthe url to GET
headersrequest headers

◆ md_http_get_impl_data()

void* md_http_get_impl_data ( md_http_t http)

◆ md_http_GET_perform()

apr_status_t md_http_GET_perform ( md_http_t http,
const char *  url,
struct apr_table_t headers,
md_http_response_cb cb,
void *  baton 
)

◆ md_http_HEAD_create()

apr_status_t md_http_HEAD_create ( md_http_request_t **  preq,
md_http_t http,
const char *  url,
struct apr_table_t headers 
)

Create a HEAD request.

Parameters
preqthe created request after success
httpthe md_http instance
urlthe url to GET
headersrequest headers

◆ md_http_HEAD_perform()

apr_status_t md_http_HEAD_perform ( md_http_t http,
const char *  url,
struct apr_table_t headers,
md_http_response_cb cb,
void *  baton 
)

◆ md_http_multi_perform()

apr_status_t md_http_multi_perform ( md_http_t http,
md_http_next_req nextreq,
void *  baton 
)

Perform requests in parallel as retrieved from the nextreq function. There are as many requests in flight as the nextreq functions provides.

To limit the number of parallel requests, nextreq should return APR_ENOENT when the limit is reached. It will be called again when the number of in_flight requests changes.

When all requests are done, nextreq will be called one more time. Should it not return anything, this function returns.

◆ md_http_perform()

apr_status_t md_http_perform ( md_http_request_t request)

Perform the request. Then this function returns, the request and all its memory has been freed and must no longer be used.

◆ md_http_POST_create()

apr_status_t md_http_POST_create ( md_http_request_t **  preq,
md_http_t http,
const char *  url,
struct apr_table_t headers,
const char *  content_type,
struct apr_bucket_brigade body,
int  detect_len 
)

Create a POST request with a bucket brigade as request body.

Parameters
preqthe created request after success
httpthe md_http instance
urlthe url to GET
headersrequest headers
content_typethe content_type of the body or NULL
bodythe body of the request or NULL
detect_lenscan the body to detect its length

◆ md_http_POST_perform()

apr_status_t md_http_POST_perform ( md_http_t http,
const char *  url,
struct apr_table_t headers,
const char *  content_type,
struct apr_bucket_brigade body,
int  detect_len,
md_http_response_cb cb,
void *  baton 
)

◆ md_http_POSTd_create()

apr_status_t md_http_POSTd_create ( md_http_request_t **  preq,
md_http_t http,
const char *  url,
struct apr_table_t headers,
const char *  content_type,
const struct md_data_t body 
)

Create a POST request with known request body data.

Parameters
preqthe created request after success
httpthe md_http instance
urlthe url to GET
headersrequest headers
content_typethe content_type of the body or NULL
bodythe body of the request or NULL

◆ md_http_POSTd_perform()

apr_status_t md_http_POSTd_perform ( md_http_t http,
const char *  url,
struct apr_table_t headers,
const char *  content_type,
const struct md_data_t body,
md_http_response_cb cb,
void *  baton 
)

◆ md_http_req_destroy()

void md_http_req_destroy ( md_http_request_t req)

◆ md_http_set_ca_file()

void md_http_set_ca_file ( md_http_t http,
const char *  ca_file 
)

Set a CA file (in PERM format) to use for root certificates when verifying SSL connections. If not set (or set to NULL), the systems certificate store will be used.

◆ md_http_set_connect_timeout()

void md_http_set_connect_timeout ( md_http_request_t req,
apr_time_t  timeout 
)

◆ md_http_set_connect_timeout_default()

void md_http_set_connect_timeout_default ( md_http_t http,
apr_time_t  timeout 
)

Set the timeout for establishing a connection. Set to 0 the have no special timeout for this.

◆ md_http_set_impl_data()

void md_http_set_impl_data ( md_http_t http,
void *  data 
)

get/set data the implementation wants to remember between requests in the same md_http_t instance.

◆ md_http_set_on_response_cb()

void md_http_set_on_response_cb ( md_http_request_t req,
md_http_response_cb cb,
void *  baton 
)

Set the callback to be invoked when the complete response has been successfully received. The HTTP status may be 500, however.

Parameters
reqthe request
cbthe callback to invoke on the response
batondata passed to the callback

◆ md_http_set_on_status_cb()

void md_http_set_on_status_cb ( md_http_request_t req,
md_http_status_cb cb,
void *  baton 
)

Set the callback to be invoked once the status of a request is known.

Parameters
reqthe request
cbthe callback to invoke on the response
batondata passed to the callback

◆ md_http_set_response_limit()

void md_http_set_response_limit ( md_http_t http,
apr_off_t  resp_limit 
)

◆ md_http_set_stalling()

void md_http_set_stalling ( md_http_request_t req,
long  bytes_per_sec,
apr_time_t  timeout 
)

◆ md_http_set_stalling_default()

void md_http_set_stalling_default ( md_http_t http,
long  bytes_per_sec,
apr_time_t  timeout 
)

Set the condition for when a transfer is considered "stalled", e.g. does not progress at a sufficient rate and will be aborted. Set to 0 the have no stall detection in place.

◆ md_http_set_timeout()

void md_http_set_timeout ( md_http_request_t req,
apr_time_t  timeout 
)

◆ md_http_set_timeout_default()

void md_http_set_timeout_default ( md_http_t http,
apr_time_t  timeout 
)

Set the timeout for the complete request. This needs to take everything from DNS looksups, to conntects, to transfer of all data into account and should be sufficiently large. Set to 0 the have no timeout for this.

◆ md_http_set_unix_socket_path()

void md_http_set_unix_socket_path ( md_http_t http,
const char *  path 
)

Set the path of a unix domain socket for use instead of TCP in a connection. Disable by providing NULL as path.

◆ md_http_use_implementation()

void md_http_use_implementation ( md_http_impl_t impl)