definitions for http client socket api More...
#include "common.h"
#include <time.h>
#include "config.h"
#include "hashtable.h"
#include "vector.h"
#include "thread.h"
#include "http.h"
#include "client.h"
Go to the source code of this file.
Data Structures | |
struct | _cp_httpclient |
http client socket wrapper More... | |
struct | _cp_url_descriptor |
struct | _cp_httpclient_result |
wrapper for asynchronous interface callback More... | |
struct | _cp_httpclient_ctl |
asynchronous interface control block. More... | |
struct | _cp_http_transfer_descriptor |
transfer descriptor for async interface More... | |
Defines | |
#define | DEFAULT_MAX_REDIRECTS 10 |
Typedefs | |
typedef CPROPS_DLL struct _cp_httpclient | cp_httpclient |
http client socket wrapper | |
typedef CPROPS_DLL struct _cp_url_descriptor | cp_url_descriptor |
wrapper for url information | |
typedef CPROPS_DLL struct _cp_httpclient_result | cp_httpclient_result |
wrapper for asynchronous interface callback | |
typedef CPROPS_DLL struct _cp_httpclient_ctl | cp_httpclient_ctl |
asynchronous interface control block. | |
typedef void(* | cp_httpclient_callback )(cp_httpclient_result *response) |
typedef CPROPS_DLL struct _cp_http_transfer_descriptor | cp_http_transfer_descriptor |
transfer descriptor for async interface | |
Enumerations | |
enum | cp_http_result_status { CP_HTTP_RESULT_SUCCESS, CP_HTTP_RESULT_CONNECTION_FAILED, CP_HTTP_RESULT_CONNECTION_RESET, CP_HTTP_RESULT_TIMED_OUT, CP_HTTP_RESULT_WRITE_ERROR, CP_HTTP_RESULT_READ_ERROR } |
result codes for HTTP requests | |
Functions | |
__BEGIN_DECLS CPROPS_DLL int | cp_httpclient_init () |
api initialization function | |
CPROPS_DLL int | cp_httpclient_shutdown () |
api cleanup function | |
CPROPS_DLL cp_httpclient * | cp_httpclient_create (char *host, int port) |
create an http client wrapper to communicate with the given host on the given port | |
CPROPS_DLL cp_httpclient * | cp_httpclient_create_proxy (char *host, int port, char *proxy_host, int proxy_port) |
create an http client wrapper to communicate with the given host on the given port using the given proxy settings | |
CPROPS_DLL void | cp_httpclient_destroy (cp_httpclient *client) |
deallocate a cp_httpclient wrapper. | |
CPROPS_DLL void | cp_httpclient_set_http_version (cp_httpclient *client, cp_http_version version) |
set the HTTP version for subsequent requests | |
CPROPS_DLL void | cp_httpclient_set_request_type (cp_httpclient *client, cp_http_request_type type) |
set the request type for subsequent requests. | |
CPROPS_DLL void | cp_httpclient_set_header (cp_httpclient *client, char *header, char *value) |
set an arbitrary header. | |
CPROPS_DLL void | cp_httpclient_set_auto_drop_headers (cp_httpclient *client, short mode) |
determine whether headers are automatically deleted or not - disabled by default | |
CPROPS_DLL void | cp_httpclient_drop_headers (cp_httpclient *client) |
deallocate cgi parameters | |
CPROPS_DLL void * | cp_httpclient_set_parameter (cp_httpclient *client, char *name, char *value) |
set a cgi parameter | |
CPROPS_DLL void | cp_httpclient_set_auto_drop_parameters (cp_httpclient *client, short mode) |
determine whether cgi parameters are automatically deleted or not - enabled by default | |
CPROPS_DLL void | cp_httpclient_drop_parameters (cp_httpclient *client) |
deallocate cgi parameters | |
CPROPS_DLL void | cp_httpclient_set_user_agent (cp_httpclient *client, char *agent) |
set a value for the 'User-Agent' header. | |
CPROPS_DLL void | cp_httpclient_set_timeout (cp_httpclient *client, int sec, int usec) |
set the timeout value for the underlying tcp socket | |
CPROPS_DLL void | cp_httpclient_set_retry (cp_httpclient *client, int retry_count) |
set the number of times to retry a connection on failure | |
CPROPS_DLL void | cp_httpclient_allow_redirects (cp_httpclient *client, int mode) |
set client behavior on HTTP 302, 302 etc. | |
CPROPS_DLL void | cp_httpclient_set_max_redirects (cp_httpclient *client, int max) |
maximal number of server redirect directives to follow - default is 10 | |
CPROPS_DLL int | cp_httpclient_reopen (cp_httpclient *client, char *host, int port) |
use the same wrapper for a different address. | |
CPROPS_DLL cp_url_descriptor * | cp_url_descriptor_create (char *host, short ssl, int port, char *uri) |
CPROPS_DLL void | cp_url_descriptor_destroy (cp_url_descriptor *desc) |
CPROPS_DLL short | cp_url_descriptor_ssl (cp_url_descriptor *desc) |
CPROPS_DLL char * | cp_url_descriptor_host (cp_url_descriptor *desc) |
CPROPS_DLL int | cp_url_descriptor_port (cp_url_descriptor *desc) |
CPROPS_DLL char * | cp_url_descriptor_uri (cp_url_descriptor *desc) |
CPROPS_DLL cp_url_descriptor * | cp_url_descriptor_parse (char *url) |
CPROPS_DLL cp_httpclient_result * | cp_httpclient_result_create (cp_httpclient *client) |
(internal) create a cp_httpclient_result object | |
CPROPS_DLL void | cp_httpclient_result_destroy (cp_httpclient_result *res) |
destructor for cp_httpclient_result objects | |
CPROPS_DLL void * | cp_httpclient_result_id (cp_httpclient_result *res) |
get the client assigned id from a result descriptor | |
CPROPS_DLL cp_http_result_status | cp_httpclient_result_status (cp_httpclient_result *res) |
get the result status code from a result descriptor | |
CPROPS_DLL cp_http_response * | cp_httpclient_result_get_response (cp_httpclient_result *res) |
get the response object from a result descriptor | |
CPROPS_DLL cp_httpclient * | cp_httpclient_result_get_client (cp_httpclient_result *res) |
get the client object the response was made on | |
CPROPS_DLL cp_httpclient_result * | cp_httpclient_fetch (cp_httpclient *client, char *uri) |
read uri content - synchronous interface | |
CPROPS_DLL cp_httpclient_ctl * | cp_httpclient_ctl_create (int background) |
create an asynchronous client transfer block for separate transfers. | |
CPROPS_DLL void | cp_httpclient_ctl_destroy (cp_httpclient_ctl *ctl) |
transfer blocks created with cp_httpclient_ctl_create() are not released by the framework and must be finalized by calling cp_httpclient_ctl_destroy(). | |
CPROPS_DLL fd_set * | cp_httpclient_ctl_default_get_read_fd_set (int *num) |
retrieve a read file descriptor set for select() for the default transfer control block. | |
CPROPS_DLL fd_set * | cp_httpclient_ctl_get_read_fd_set (cp_httpclient_ctl *ctl, int *num) |
retrieve a read file descriptor set prepared for select(). | |
CPROPS_DLL fd_set * | cp_httpclient_ctl_default_get_write_fd_set (int *num) |
retrieve a write file descriptor set for select() for the default transfer control block. | |
CPROPS_DLL fd_set * | cp_httpclient_ctl_get_write_fd_set (cp_httpclient_ctl *ctl, int *num) |
retrieve a write file descriptor set prepared for select(). | |
CPROPS_DLL cp_http_transfer_descriptor * | cp_http_transfer_descriptor_create (void *id, cp_httpclient *client, cp_httpclient_callback callback, char *uri) |
CPROPS_DLL void | cp_http_transfer_descriptor_destroy (cp_http_transfer_descriptor *desc) |
CPROPS_DLL int | cp_httpclient_fetch_nb (cp_httpclient *client, char *uri, void *id, cp_httpclient_callback callback, int background) |
perform an asynchronous fetch. | |
CPROPS_DLL int | cp_httpclient_fetch_ctl (cp_httpclient_ctl *ctl, cp_httpclient *client, char *uri, void *id, cp_httpclient_callback callback) |
same as cp_httpclient_fetch_nb but allows specifying a different asynchronous transfer control block. | |
CPROPS_DLL int | cp_httpclient_fetch_nb_exec () |
non-blocking fetches executing in the foreground must be driven by calls to cp_httpclient_fetch_nb_exec(). | |
CPROPS_DLL int | cp_httpclient_fetch_ctl_exec (cp_httpclient_ctl *ctl) |
same as cp_httpclient_fetch_nb_exec() but allows specifying a different aysnchronous transfer control block. |
definitions for http client socket api