serf.h (0.7.2) | | serf.h (1.0.0) |
| | |
skipping to change at line 71 ¶ | | skipping to change at line 71 ¶ |
| | |
/* This code is for when this is the last response on this connection: | | /* This code is for when this is the last response on this connection: |
* i.e. do not send any more requests on this connection or expect | | * i.e. do not send any more requests on this connection or expect |
* any more responses. | | * any more responses. |
*/ | | */ |
#define SERF_ERROR_CLOSING (APR_OS_START_USERERR + SERF_ERROR_RANGE + 1) | | #define SERF_ERROR_CLOSING (APR_OS_START_USERERR + SERF_ERROR_RANGE + 1) |
/* This code is for when the connection terminated before the request | | /* This code is for when the connection terminated before the request |
* could be processed on the other side. | | * could be processed on the other side. |
*/ | | */ |
#define SERF_ERROR_REQUEST_LOST (APR_OS_START_USERERR + SERF_ERROR_RANGE +
2) | | #define SERF_ERROR_REQUEST_LOST (APR_OS_START_USERERR + SERF_ERROR_RANGE +
2) |
| | /* This code is for when the connection is blocked - we can not proceed |
| | * until something happens - generally due to SSL negotiation-like behavior |
| | * where a write() is blocked until a read() is processed. |
| | */ |
| | #define SERF_ERROR_WAIT_CONN (APR_OS_START_USERERR + SERF_ERROR_RANGE + 3) |
| | /* This code is for when something went wrong during deflating compressed |
| | * data e.g. a CRC error. */ |
| | #define SERF_ERROR_DECOMPRESSION_FAILED (APR_OS_START_USERERR + \ |
| | SERF_ERROR_RANGE + 4) |
| | /* This code is for when a response received from a http server is not in |
| | * http-compliant syntax. */ |
| | #define SERF_ERROR_BAD_HTTP_RESPONSE (APR_OS_START_USERERR + \ |
| | SERF_ERROR_RANGE + 5) |
| | |
/* General authentication related errors */ | | /* General authentication related errors */ |
#define SERF_ERROR_AUTHN_FAILED (APR_OS_START_USERERR + SERF_ERROR_RANGE +
90) | | #define SERF_ERROR_AUTHN_FAILED (APR_OS_START_USERERR + SERF_ERROR_RANGE +
90) |
| | |
/* None of the available authn mechanisms for the request are supported */ | | /* None of the available authn mechanisms for the request are supported */ |
#define SERF_ERROR_AUTHN_NOT_SUPPORTED (APR_OS_START_USERERR + SERF_ERROR_R
ANGE + 91) | | #define SERF_ERROR_AUTHN_NOT_SUPPORTED (APR_OS_START_USERERR + SERF_ERROR_R
ANGE + 91) |
| | |
/* Authn was requested by the server but the header lacked some attribute
*/ | | /* Authn was requested by the server but the header lacked some attribute
*/ |
#define SERF_ERROR_AUTHN_MISSING_ATTRIBUTE (APR_OS_START_USERERR + SERF_ERR
OR_RANGE + 92) | | #define SERF_ERROR_AUTHN_MISSING_ATTRIBUTE (APR_OS_START_USERERR + SERF_ERR
OR_RANGE + 92) |
| | |
/* Authentication handler initialization related errors */ | | /* Authentication handler initialization related errors */ |
#define SERF_ERROR_AUTHN_INITALIZATION_FAILED (APR_OS_START_USERERR +\ | | #define SERF_ERROR_AUTHN_INITALIZATION_FAILED (APR_OS_START_USERERR +\ |
SERF_ERROR_RANGE + 93) | | SERF_ERROR_RANGE + 93) |
| | |
| | /* This macro groups errors potentially raised when reading a http response |
| | . */ |
| | #define SERF_BAD_RESPONSE_ERROR(status) ((status) \ |
| | && ((SERF_ERROR_DECOMPRESSION_FAILED == (status)) \ |
| | ||(SERF_ERROR_BAD_HTTP_RESPONSE == (status)))) |
| | |
| | /** |
| | * Return a string that describes the specified error code. |
| | * |
| | * If the error code is not one of the above Serf error codes, then |
| | * NULL will be returned. |
| | * |
| | * Note regarding lifetime: the string is a statically-allocated constant |
| | */ |
| | const char *serf_error_string(apr_status_t errcode); |
| | |
/** | | /** |
* Create a new context for serf operations. | | * Create a new context for serf operations. |
* | | * |
* A serf context defines a control loop which processes multiple | | * A serf context defines a control loop which processes multiple |
* connections simultaneously. | | * connections simultaneously. |
* | | * |
* The context will be allocated within @a pool. | | * The context will be allocated within @a pool. |
*/ | | */ |
serf_context_t *serf_context_create( | | serf_context_t *serf_context_create( |
apr_pool_t *pool); | | apr_pool_t *pool); |
| | |
skipping to change at line 808 ¶ | | skipping to change at line 836 ¶ |
* APR_EAGAIN will never be returned. | | * APR_EAGAIN will never be returned. |
*/ | | */ |
apr_status_t (*peek)(serf_bucket_t *bucket, | | apr_status_t (*peek)(serf_bucket_t *bucket, |
const char **data, apr_size_t *len); | | const char **data, apr_size_t *len); |
| | |
/** | | /** |
* Destroy @a bucket, along with any associated resources. | | * Destroy @a bucket, along with any associated resources. |
*/ | | */ |
void (*destroy)(serf_bucket_t *bucket); | | void (*destroy)(serf_bucket_t *bucket); |
| | |
/** | | |
* Save the current state of the @a bucket for later retrieval and retu | | |
rn | | |
* APR_SUCCESS. A previously set snapshot will be cleared. | | |
* In case of error, the bucket should be considered invalid. | | |
*/ | | |
apr_status_t (*snapshot)(serf_bucket_t *bucket); | | |
| | |
/** | | |
* Restore the state of the @a bucket to the state set in the last | | |
* snapshot and returns APR_SUCCESS. If no snapshot was set, the bucket | | |
's | | |
* state is unchanged and APR_SUCCESS is returned. | | |
* In case of error, the bucket should be considered invalid. | | |
*/ | | |
apr_status_t (*restore_snapshot)(serf_bucket_t *bucket); | | |
| | |
/** | | |
* Test if a snapshot is set. Returns 0 if no snapshot was set, a non-0 | | |
* value if there is a snapshot set. | | |
*/ | | |
int (*is_snapshot_set)(serf_bucket_t *bucket); | | |
| | |
/* ### apr buckets have 'copy', 'split', and 'setaside' functions. | | /* ### apr buckets have 'copy', 'split', and 'setaside' functions. |
### not sure whether those will be needed in this bucket model. | | ### not sure whether those will be needed in this bucket model. |
*/ | | */ |
}; | | }; |
| | |
/** | | /** |
* Should the use and lifecycle of buckets be tracked? | | * Should the use and lifecycle of buckets be tracked? |
* | | * |
* When tracking, the system will ensure several semantic requirements | | * When tracking, the system will ensure several semantic requirements |
* of bucket use: | | * of bucket use: |
| | |
skipping to change at line 872 ¶ | | skipping to change at line 879 ¶ |
#define serf_bucket_read(b,r,d,l) SERF__RECREAD(b, (b)->type->read(b,r,d,l)
) | | #define serf_bucket_read(b,r,d,l) SERF__RECREAD(b, (b)->type->read(b,r,d,l)
) |
#define serf_bucket_readline(b,a,f,d,l) \ | | #define serf_bucket_readline(b,a,f,d,l) \ |
SERF__RECREAD(b, (b)->type->readline(b,a,f,d,l)) | | SERF__RECREAD(b, (b)->type->readline(b,a,f,d,l)) |
#define serf_bucket_read_iovec(b,r,s,v,u) \ | | #define serf_bucket_read_iovec(b,r,s,v,u) \ |
SERF__RECREAD(b, (b)->type->read_iovec(b,r,s,v,u)) | | SERF__RECREAD(b, (b)->type->read_iovec(b,r,s,v,u)) |
#define serf_bucket_read_for_sendfile(b,r,h,f,o,l) \ | | #define serf_bucket_read_for_sendfile(b,r,h,f,o,l) \ |
SERF__RECREAD(b, (b)->type->read_for_sendfile(b,r,h,f,o,l)) | | SERF__RECREAD(b, (b)->type->read_for_sendfile(b,r,h,f,o,l)) |
#define serf_bucket_read_bucket(b,t) ((b)->type->read_bucket(b,t)) | | #define serf_bucket_read_bucket(b,t) ((b)->type->read_bucket(b,t)) |
#define serf_bucket_peek(b,d,l) ((b)->type->peek(b,d,l)) | | #define serf_bucket_peek(b,d,l) ((b)->type->peek(b,d,l)) |
#define serf_bucket_destroy(b) ((b)->type->destroy(b)) | | #define serf_bucket_destroy(b) ((b)->type->destroy(b)) |
#define serf_bucket_snapshot(b) ((b)->type->snapshot(b)) | | |
#define serf_bucket_restore_snapshot(b) ((b)->type->restore_snapshot(b)) | | |
#define serf_bucket_is_snapshot_set(b) ((b)->type->is_snapshot_set(b)) | | |
| | |
/** | | /** |
* Check whether a real error occurred. Note that bucket read functions | | * Check whether a real error occurred. Note that bucket read functions |
* can return EOF and EAGAIN as part of their "normal" operation, so they | | * can return EOF and EAGAIN as part of their "normal" operation, so they |
* should not be considered an error. | | * should not be considered an error. |
*/ | | */ |
#define SERF_BUCKET_READ_ERROR(status) ((status) \ | | #define SERF_BUCKET_READ_ERROR(status) ((status) \ |
&& !APR_STATUS_IS_EOF(status) \ | | && !APR_STATUS_IS_EOF(status) \ |
&& !APR_STATUS_IS_EAGAIN(status)) | | && !APR_STATUS_IS_EAGAIN(status) \ |
| | && (SERF_ERROR_WAIT_CONN != status) |
| | ) |
| | |
struct serf_bucket_t { | | struct serf_bucket_t { |
| | |
/** the type of this bucket */ | | /** the type of this bucket */ |
const serf_bucket_type_t *type; | | const serf_bucket_type_t *type; |
| | |
/** bucket-private data */ | | /** bucket-private data */ |
void *data; | | void *data; |
| | |
/** the allocator used for this bucket (needed at destroy time) */ | | /** the allocator used for this bucket (needed at destroy time) */ |
| | |
skipping to change at line 1012 ¶ | | skipping to change at line 1017 ¶ |
void serf_debug__entered_loop( | | void serf_debug__entered_loop( |
serf_bucket_alloc_t *allocator); | | serf_bucket_alloc_t *allocator); |
void serf_debug__closed_conn( | | void serf_debug__closed_conn( |
serf_bucket_alloc_t *allocator); | | serf_bucket_alloc_t *allocator); |
void serf_debug__bucket_destroy( | | void serf_debug__bucket_destroy( |
const serf_bucket_t *bucket); | | const serf_bucket_t *bucket); |
void serf_debug__bucket_alloc_check( | | void serf_debug__bucket_alloc_check( |
serf_bucket_alloc_t *allocator); | | serf_bucket_alloc_t *allocator); |
| | |
/* Version info */ | | /* Version info */ |
#define SERF_MAJOR_VERSION 0 | | #define SERF_MAJOR_VERSION 1 |
#define SERF_MINOR_VERSION 7 | | #define SERF_MINOR_VERSION 0 |
#define SERF_PATCH_VERSION 2 | | #define SERF_PATCH_VERSION 0 |
| | |
/* Version number string */ | | /* Version number string */ |
#define SERF_VERSION_STRING APR_STRINGIFY(SERF_MAJOR_VERSION) "." \ | | #define SERF_VERSION_STRING APR_STRINGIFY(SERF_MAJOR_VERSION) "." \ |
APR_STRINGIFY(SERF_MINOR_VERSION) "." \ | | APR_STRINGIFY(SERF_MINOR_VERSION) "." \ |
APR_STRINGIFY(SERF_PATCH_VERSION) | | APR_STRINGIFY(SERF_PATCH_VERSION) |
| | |
/** | | /** |
* Check at compile time if the Serf version is at least a certain | | * Check at compile time if the Serf version is at least a certain |
* level. | | * level. |
* @param major The major version component of the version checked | | * @param major The major version component of the version checked |
| | |
End of changes. 6 change blocks. |
30 lines changed or deleted | | 35 lines changed or added |
|
serf_bucket_types.h (0.7.2) | | serf_bucket_types.h (1.0.0) |
| | |
skipping to change at line 439 ¶ | | skipping to change at line 439 ¶ |
serf_bucket_alloc_t *allocator, | | serf_bucket_alloc_t *allocator, |
int format); | | int format); |
| | |
/* ==================================================================== */ | | /* ==================================================================== */ |
| | |
extern const serf_bucket_type_t serf_bucket_type_limit; | | extern const serf_bucket_type_t serf_bucket_type_limit; |
#define SERF_BUCKET_IS_LIMIT(b) SERF_BUCKET_CHECK((b), limit) | | #define SERF_BUCKET_IS_LIMIT(b) SERF_BUCKET_CHECK((b), limit) |
| | |
serf_bucket_t *serf_bucket_limit_create( | | serf_bucket_t *serf_bucket_limit_create( |
serf_bucket_t *stream, | | serf_bucket_t *stream, |
apr_size_t limit, | | apr_uint64_t limit, |
serf_bucket_alloc_t *allocator); | | serf_bucket_alloc_t *allocator); |
| | |
/* ==================================================================== */ | | /* ==================================================================== */ |
#define SERF_SSL_CERT_NOTYETVALID 1 | | #define SERF_SSL_CERT_NOTYETVALID 1 |
#define SERF_SSL_CERT_EXPIRED 2 | | #define SERF_SSL_CERT_EXPIRED 2 |
#define SERF_SSL_CERT_UNKNOWNCA 4 | | #define SERF_SSL_CERT_UNKNOWNCA 4 |
#define SERF_SSL_CERT_SELF_SIGNED 8 | | #define SERF_SSL_CERT_SELF_SIGNED 8 |
#define SERF_SSL_CERT_UNKNOWN_FAILURE 16 | | #define SERF_SSL_CERT_UNKNOWN_FAILURE 16 |
| | |
extern const serf_bucket_type_t serf_bucket_type_ssl_encrypt; | | extern const serf_bucket_type_t serf_bucket_type_ssl_encrypt; |
| | |
skipping to change at line 497 ¶ | | skipping to change at line 497 ¶ |
serf_ssl_need_server_cert_t callback, | | serf_ssl_need_server_cert_t callback, |
void *data); | | void *data); |
| | |
/** | | /** |
* Use the default root CA certificates as included with the OpenSSL librar
y. | | * Use the default root CA certificates as included with the OpenSSL librar
y. |
*/ | | */ |
apr_status_t serf_ssl_use_default_certificates( | | apr_status_t serf_ssl_use_default_certificates( |
serf_ssl_context_t *context); | | serf_ssl_context_t *context); |
| | |
/** | | /** |
| | * Allow SNI indicators to be sent to the server. |
| | */ |
| | apr_status_t serf_ssl_set_hostname( |
| | serf_ssl_context_t *context, const char *hostname); |
| | |
| | /** |
* Return the depth of the certificate. | | * Return the depth of the certificate. |
*/ | | */ |
int serf_ssl_cert_depth( | | int serf_ssl_cert_depth( |
const serf_ssl_certificate_t *cert); | | const serf_ssl_certificate_t *cert); |
| | |
/** | | /** |
* Extract the fields of the issuer in a table with keys (E, CN, OU, O, L, | | * Extract the fields of the issuer in a table with keys (E, CN, OU, O, L, |
* ST and C). The returned table will be allocated in @a pool. | | * ST and C). The returned table will be allocated in @a pool. |
*/ | | */ |
apr_hash_t *serf_ssl_cert_issuer( | | apr_hash_t *serf_ssl_cert_issuer( |
| | |
skipping to change at line 585 ¶ | | skipping to change at line 591 ¶ |
| | |
extern const serf_bucket_type_t serf_bucket_type_barrier; | | extern const serf_bucket_type_t serf_bucket_type_barrier; |
#define SERF_BUCKET_IS_BARRIER(b) SERF_BUCKET_CHECK((b), barrier) | | #define SERF_BUCKET_IS_BARRIER(b) SERF_BUCKET_CHECK((b), barrier) |
| | |
serf_bucket_t *serf_bucket_barrier_create( | | serf_bucket_t *serf_bucket_barrier_create( |
serf_bucket_t *stream, | | serf_bucket_t *stream, |
serf_bucket_alloc_t *allocator); | | serf_bucket_alloc_t *allocator); |
| | |
/* ==================================================================== */ | | /* ==================================================================== */ |
| | |
| | extern const serf_bucket_type_t serf_bucket_type_iovec; |
| | #define SERF_BUCKET_IS_IOVEC(b) SERF_BUCKET_CHECK((b), iovec) |
| | |
| | serf_bucket_t *serf_bucket_iovec_create( |
| | struct iovec vecs[], |
| | int len, |
| | serf_bucket_alloc_t *allocator); |
| | |
| | /* ==================================================================== */ |
| | |
/* ### do we need a PIPE bucket type? they are simple apr_file_t objects */ | | /* ### do we need a PIPE bucket type? they are simple apr_file_t objects */ |
| | |
#ifdef __cplusplus | | #ifdef __cplusplus |
} | | } |
#endif | | #endif |
| | |
#endif /* !SERF_BUCKET_TYPES_H */ | | #endif /* !SERF_BUCKET_TYPES_H */ |
| | |
End of changes. 3 change blocks. |
1 lines changed or deleted | | 17 lines changed or added |
|
serf_private.h (0.7.2) | | serf_private.h (1.0.0) |
| | |
skipping to change at line 68 ¶ | | skipping to change at line 68 ¶ |
| | |
serf_response_acceptor_t acceptor; | | serf_response_acceptor_t acceptor; |
void *acceptor_baton; | | void *acceptor_baton; |
| | |
serf_response_handler_t handler; | | serf_response_handler_t handler; |
void *handler_baton; | | void *handler_baton; |
| | |
serf_bucket_t *resp_bkt; | | serf_bucket_t *resp_bkt; |
| | |
int written; | | int written; |
| | int priority; |
| | |
struct serf_request_t *next; | | struct serf_request_t *next; |
}; | | }; |
| | |
typedef struct serf_pollset_t { | | typedef struct serf_pollset_t { |
/* the set of connections to poll */ | | /* the set of connections to poll */ |
apr_pollset_t *pollset; | | apr_pollset_t *pollset; |
} serf_pollset_t; | | } serf_pollset_t; |
| | |
typedef struct serf__authn_info_t { | | typedef struct serf__authn_info_t { |
| | |
skipping to change at line 126 ¶ | | skipping to change at line 127 ¶ |
serf_credentials_callback_t cred_cb; | | serf_credentials_callback_t cred_cb; |
}; | | }; |
| | |
struct serf_listener_t { | | struct serf_listener_t { |
serf_context_t *ctx; | | serf_context_t *ctx; |
serf_io_baton_t baton; | | serf_io_baton_t baton; |
apr_socket_t *skt; | | apr_socket_t *skt; |
apr_pool_t *pool; | | apr_pool_t *pool; |
apr_pollfd_t desc; | | apr_pollfd_t desc; |
void *accept_baton; | | void *accept_baton; |
serf_accept_client_t accept; | | serf_accept_client_t accept_func; |
}; | | }; |
| | |
struct serf_incoming_t { | | struct serf_incoming_t { |
serf_context_t *ctx; | | serf_context_t *ctx; |
serf_io_baton_t baton; | | serf_io_baton_t baton; |
void *request_baton; | | void *request_baton; |
serf_incoming_request_cb_t request; | | serf_incoming_request_cb_t request; |
apr_socket_t *skt; | | apr_socket_t *skt; |
apr_pollfd_t desc; | | apr_pollfd_t desc; |
}; | | }; |
| | |
| | /* States for the different stages in the lifecyle of a connection. */ |
| | typedef enum { |
| | SERF_CONN_INIT, /* no socket created yet */ |
| | SERF_CONN_SETUP_SSLTUNNEL, /* ssl tunnel being setup, no requests sent |
| | */ |
| | SERF_CONN_CONNECTED, /* conn is ready to send requests */ |
| | SERF_CONN_CLOSING, /* conn is closing, no more requests, |
| | start a new socket */ |
| | } serf__connection_state_t; |
| | |
struct serf_connection_t { | | struct serf_connection_t { |
serf_context_t *ctx; | | serf_context_t *ctx; |
| | |
apr_status_t status; | | apr_status_t status; |
serf_io_baton_t baton; | | serf_io_baton_t baton; |
| | |
apr_pool_t *pool; | | apr_pool_t *pool; |
serf_bucket_alloc_t *allocator; | | serf_bucket_alloc_t *allocator; |
| | |
apr_sockaddr_t *address; | | apr_sockaddr_t *address; |
| | |
skipping to change at line 170 ¶ | | skipping to change at line 180 ¶ |
| | |
/* number of completed requests we've sent */ | | /* number of completed requests we've sent */ |
unsigned int completed_requests; | | unsigned int completed_requests; |
| | |
/* number of completed responses we've got */ | | /* number of completed responses we've got */ |
unsigned int completed_responses; | | unsigned int completed_responses; |
| | |
/* keepalive */ | | /* keepalive */ |
unsigned int probable_keepalive_limit; | | unsigned int probable_keepalive_limit; |
| | |
/* someone has told us that the connection is closing | | /* Current state of the connection (whether or not it is connected). */ |
* so, let's start a new socket. | | serf__connection_state_t state; |
*/ | | |
int closing; | | |
| | |
/* This connection may have responses without a request! */ | | /* This connection may have responses without a request! */ |
int async_responses; | | int async_responses; |
serf_bucket_t *current_async_response; | | serf_bucket_t *current_async_response; |
serf_response_acceptor_t async_acceptor; | | serf_response_acceptor_t async_acceptor; |
void *async_acceptor_baton; | | void *async_acceptor_baton; |
serf_response_handler_t async_handler; | | serf_response_handler_t async_handler; |
void *async_handler_baton; | | void *async_handler_baton; |
| | |
/* A bucket wrapped around our socket (for reading responses). */ | | /* A bucket wrapped around our socket (for reading responses). */ |
serf_bucket_t *stream; | | serf_bucket_t *stream; |
/* A reference to the aggregate bucket that provides the boundary betwe
en | | /* A reference to the aggregate bucket that provides the boundary betwe
en |
* request level buckets and connection level buckets. | | * request level buckets and connection level buckets. |
*/ | | */ |
serf_bucket_t *ostream_head; | | serf_bucket_t *ostream_head; |
serf_bucket_t *ostream_tail; | | serf_bucket_t *ostream_tail; |
| | |
| | /* Aggregate bucket used to send the CONNECT request. */ |
| | serf_bucket_t *ssltunnel_ostream; |
| | |
/* The list of active requests. */ | | /* The list of active requests. */ |
serf_request_t *requests; | | serf_request_t *requests; |
serf_request_t *requests_tail; | | serf_request_t *requests_tail; |
| | |
/* The list of requests we're holding on to because we're going to | | /* The list of requests we're holding on to because we're going to |
* reset the connection soon. | | * reset the connection soon. |
*/ | | */ |
serf_request_t *hold_requests; | | serf_request_t *hold_requests; |
serf_request_t *hold_requests_tail; | | serf_request_t *hold_requests_tail; |
| | |
| | |
skipping to change at line 339 ¶ | | skipping to change at line 350 ¶ |
/* from incoming.c */ | | /* from incoming.c */ |
apr_status_t serf__process_client(serf_incoming_t *l, apr_int16_t events); | | apr_status_t serf__process_client(serf_incoming_t *l, apr_int16_t events); |
apr_status_t serf__process_listener(serf_listener_t *l); | | apr_status_t serf__process_listener(serf_listener_t *l); |
| | |
/* from outgoing.c */ | | /* from outgoing.c */ |
apr_status_t serf__open_connections(serf_context_t *ctx); | | apr_status_t serf__open_connections(serf_context_t *ctx); |
apr_status_t serf__process_connection(serf_connection_t *conn, | | apr_status_t serf__process_connection(serf_connection_t *conn, |
apr_int16_t events); | | apr_int16_t events); |
apr_status_t serf__conn_update_pollset(serf_connection_t *conn); | | apr_status_t serf__conn_update_pollset(serf_connection_t *conn); |
| | |
| | /* from ssltunnel.c */ |
| | apr_status_t serf__ssltunnel_connect(serf_connection_t *conn); |
| | |
#endif | | #endif |
| | |
End of changes. 6 change blocks. |
5 lines changed or deleted | | 20 lines changed or added |
|