cp_httpclient_set_header(3)
| cp_socket(3) | cp_httpclient | cp_socket(3) |
NAME
cp_httpclient_set_header, cp_httpclient_set_auto_drop_headers, cp_httpclient_drop_headers, cp_httpclient_set_parameter, cp_httpclient_set_auto_drop_parameters, cp_httpclient_drop_parameters, cp_httpclient_set_http_version, cp_httpclient_set_request_type, cp_httpclient_set_user_agent, cp_httpclient_set_timeout, cp_httpclient_set_retry, cp_httpclient_allow_redirects, cp_httpclient_set_max_redirects, cp_httpclient_set_cookie_jar - control http client behavior
SYNOPSIS
#include <cprops/httpclient.h>
void cp_httpclient_set_header(cp_httpclient
*client, char *header, char
*value);
void cp_httpclient_set_auto_drop_headers(cp_httpclient
*client, short mode);
void cp_httpclient_drop_headers(cp_httpclient *client);
void *cp_httpclient_set_parameter(cp_httpclient *client,
char *name, char *value);
void cp_httpclient_set_auto_drop_parameters(cp_httpclient
*client, short mode);
void cp_httpclient_drop_parameters(cp_httpclient
*client);
void cp_httpclient_set_http_version(cp_httpclient *client,
cp_http_version version);
void cp_httpclient_set_request_type(cp_httpclient *client,
cp_http_request_type type);
void cp_httpclient_set_user_agent(cp_httpclient *client, char
*agent);
void cp_httpclient_set_timeout(cp_httpclient *client,
int sec, int usec);
void cp_httpclient_set_retry(cp_httpclient *client, int
retry_count);
void cp_httpclient_allow_redirects(cp_httpclient *client, int
mode);
void cp_httpclient_set_max_redirects(cp_httpclient *client,
int max);
void cp_httpclient_set_cookie_jar(cp_httpclient *client,
cp_trie *jar);
DESCRIPTION
cp_httpclient_set_header sets the header name to the value value. All subsequent requests on this client will have the header set unless auto_drop_headers is set, cp_httpclient_drop_headers is called or cp_httpclient_set_header is called again with a NULL value. The auto_drop_headers mode may be set by calling cp_httpclient_set_auto_drop_headers with a non-zero value to enable auto-dropping or zero to disable. By default headers are kept between requests.
cp_httpclient_set_parameter sets a GET or POST parameter
with the name name to the value value. Subsequent calls to set
the parameter name to a different value override any existing
value. As a special case, a value of NULL removes the parameter altogether.
By default parameters are not kept between requests. To enable this call
cp_httpclient_set_auto_drop_parameters with a zero mode value.
If auto_drop_parameters is disabled, cp_httpclient_drop_parameters
may be called to clear the exiting parameter set.
cp_httpclient_set_http_version sets the HTTP version to be used for requests. Applicable version values are HTTP_1_1 (default) and HTTP_1_0.
cp_httpclient_set_request_type sets the request type. The default is GET.
cp_httpclient_set_user_agent sets the value of the User-Agent header. The default is libcprops-(version) where (version) is the cprops version number.
cp_httpclient_set_timeout allows setting the timeout for the underlying tcp connection in seconds and microseconds.
cp_httpclient_set_retry sets the number of connection retries to attempt on connection errors. The default is 3.
cp_httpclient_set_max_redirects sets the maximal number of
server redirect directives (HTTP 302, 301 etc) to follow during the
processing of a single request. The default value is 10.
Call cp_httpclient_allow_redirects with a zero or non-zero mode
value to disable or enable redirects respectively. Redirects are enabled by
default. If disabled and presented with a HTTP 302 response the
cp_http_result(3) for the request will contain the redirect page
issued by the server.
cp_httpclient_set_cookie_jar allows setting a client to use a user defined cookie jar. By default all clients share one cookie jar. The cookie jar is a cp_trie (3) object.
SEE ALSO
| MAY 2006 | libcprops |
