http-client.h revision 50d1446e71cfbdc5b6d7bafcf91b7bff453989d3
#ifndef HTTP_CLIENT_H
#define HTTP_CLIENT_H
#include "net.h"
#include "http-response.h"
struct http_response;
struct http_client;
struct http_client_request;
enum http_client_request_error {
};
enum http_request_state {
};
extern const char *http_request_state_names[];
struct http_client_settings {
const char *dns_client_socket_path;
const char *ssl_crypto_device;
bool ssl_allow_invalid_cert;
/* user cert */
/* User-Agent: header (default: none) */
const char *user_agent;
const char *rawlog_dir;
unsigned int max_idle_time_msecs;
/* maximum number of parallel connections per peer (default = 1) */
unsigned int max_parallel_connections;
/* maximum number of pipelined requests per connection (default = 1) */
unsigned int max_pipelined_requests;
/* don't automatically act upon redirect responses */
bool no_auto_redirect;
/* maximum number of redirects for a request
(default = 0; redirects refused)
*/
unsigned int max_redirects;
/* maximum number of attempts for a request */
unsigned int max_attempts;
/* response header limits */
/* max time to wait for HTTP request to finish before retrying
(default = unlimited) */
unsigned int request_timeout_msecs;
/* max time to wait for connect() (and SSL handshake) to finish before
retrying (default = request_timeout_msecs) */
unsigned int connect_timeout_msecs;
/* time to wait for connect() (and SSL handshake) to finish for the first
connection before trying the next IP in parallel
(default = 0; wait until current connection attempt finishes) */
unsigned int soft_connect_timeout_msecs;
bool debug;
};
typedef void
void *context);
struct http_client_request *
CALLBACK_TYPECHECK(callback, void (*)( \
bool ssl);
enum http_request_state
/* Call the specified callback when HTTP request is destroyed. */
void (*callback)(void *),
void *context);
/* submits request and blocks until provided payload is sent. Multiple calls
are allowed; payload transmission is ended with
http_client_request_finish_payload(). */
/* blocks until all currently submitted requests are handled */
/* Returns number of pending HTTP requests. */
#endif