diff options
Diffstat (limited to 'serf_private.h')
-rw-r--r-- | serf_private.h | 66 |
1 files changed, 58 insertions, 8 deletions
diff --git a/serf_private.h b/serf_private.h index 59e4db7..867d74e 100644 --- a/serf_private.h +++ b/serf_private.h @@ -30,6 +30,16 @@ #define SERF_IO_CONN (2) #define SERF_IO_LISTENER (3) +/* Internal logging facilities, set flag to 1 to enable console logging for + the selected component. */ +#define SSL_VERBOSE 0 +#define SSL_MSG_VERBOSE 0 /* logs decrypted requests and responses. */ +#define SOCK_VERBOSE 0 +#define SOCK_MSG_VERBOSE 0 /* logs bytes received from or written to a socket. */ +#define CONN_VERBOSE 0 +#define AUTH_VERBOSE 0 + + typedef struct serf__authn_scheme_t serf__authn_scheme_t; typedef struct serf_io_baton_t { @@ -67,6 +77,13 @@ struct serf_request_t { int written; int priority; + /* This baton is currently only used for digest authentication, which + needs access to the uri of the request in the response handler. + If serf_request_t is replaced by a serf_http_request_t in the future, + which knows about uri and method and such, this baton won't be needed + anymore. */ + void *auth_baton; + struct serf_request_t *next; }; @@ -203,12 +220,6 @@ struct serf_connection_t { serf_request_t *requests; serf_request_t *requests_tail; - /* The list of requests we're holding on to because we're going to - * reset the connection soon. - */ - serf_request_t *hold_requests; - serf_request_t *hold_requests_tail; - struct iovec vec[IOV_MAX]; int vec_len; @@ -228,10 +239,30 @@ struct serf_connection_t { /* connection and authentication scheme specific information */ void *authn_baton; void *proxy_authn_baton; + + /* Time marker when connection begins. */ + apr_time_t connect_time; + + /* Calculated connection latency. Negative value if latency is unknown. */ + apr_interval_time_t latency; }; +/*** Internal bucket functions ***/ + +/** Transform a response_bucket in-place into an aggregate bucket. Restore the + status line and all headers, not just the body. + + This can only be used when we haven't started reading the body of the + response yet. + + Keep internal for now, probably only useful within serf. + */ +apr_status_t serf_response_full_become_aggregate(serf_bucket_t *bucket); + /*** Authentication handler declarations ***/ +typedef enum { PROXY, HOST } peer_t; + /** * For each authentication scheme we need a handler function of type * serf__auth_handler_func_t. This function will be called when an @@ -273,8 +304,10 @@ typedef apr_status_t * authentication headers (if needed). */ typedef apr_status_t -(*serf__setup_request_func_t)(int code, +(*serf__setup_request_func_t)(peer_t peer, + int code, serf_connection_t *conn, + serf_request_t *request, const char *method, const char *uri, serf_bucket_t *hdrs_bkt); @@ -285,7 +318,8 @@ typedef apr_status_t * (if needed). */ typedef apr_status_t -(*serf__validate_response_func_t)(int code, +(*serf__validate_response_func_t)(peer_t peer, + int code, serf_connection_t *conn, serf_request_t *request, serf_bucket_t *response, @@ -350,4 +384,20 @@ apr_status_t serf__conn_update_pollset(serf_connection_t *conn); /* from ssltunnel.c */ apr_status_t serf__ssltunnel_connect(serf_connection_t *conn); + +/** Logging functions. Use one of the [COMP]_VERBOSE flags to enable specific + logging. + **/ + +/* Logs a standard event, with filename & timestamp header */ +void serf__log(int verbose_flag, const char *filename, const char *fmt, ...); + +/* Logs a standard event, but without prefix. This is useful to build up + log lines in parts. */ +void serf__log_nopref(int verbose_flag, const char *fmt, ...); + +/* Logs a socket event, add local and remote ip address:port */ +void serf__log_skt(int verbose_flag, const char *filename, apr_socket_t *skt, + const char *fmt, ...); + #endif |