summaryrefslogtreecommitdiff
path: root/http-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-10-21 12:23:10 -0400
committerNick Mathewson <nickm@torproject.org>2010-10-21 12:23:10 -0400
commit2a3b5872fe1a2fa0f67d1b435b4650d337c16c4d (patch)
tree47ca71259580427ca99f669890750d7b496be4f8 /http-internal.h
parentcd00079b2266893472fac795a69fe8aaea6c52e0 (diff)
parent90b3ed5bc840480f1c1d40f93bc2d850e3830d64 (diff)
downloadlibevent-2a3b5872fe1a2fa0f67d1b435b4650d337c16c4d.tar.gz
Merge branch 'http_small_tweaks'
Conflicts: http-internal.h
Diffstat (limited to 'http-internal.h')
-rw-r--r--http-internal.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/http-internal.h b/http-internal.h
index 073dd488..0a07643f 100644
--- a/http-internal.h
+++ b/http-internal.h
@@ -40,8 +40,6 @@ struct evbuffer;
struct addrinfo;
struct evhttp_request;
-/* A stupid connection object - maybe make this a bufferevent later */
-
enum evhttp_connection_state {
EVCON_DISCONNECTED, /**< not currently connected not trying either*/
EVCON_CONNECTING, /**< tries to currently connect */
@@ -56,8 +54,10 @@ enum evhttp_connection_state {
struct event_base;
+/* A client or server connection. */
struct evhttp_connection {
- /* we use tailq only if they were created for an http server */
+ /* we use this tailq only if this connection was created for an http
+ * server */
TAILQ_ENTRY(evhttp_connection) next;
evutil_socket_t fd;
@@ -100,6 +100,7 @@ struct evhttp_connection {
struct evdns_base *dns_base;
};
+/* A callback for an http server */
struct evhttp_cb {
TAILQ_ENTRY(evhttp_cb) next;
@@ -120,11 +121,15 @@ struct evhttp_bound_socket {
};
struct evhttp {
- TAILQ_ENTRY(evhttp) next;
+ /* Next vhost, if this is a vhost. */
+ TAILQ_ENTRY(evhttp) next_vhost;
+ /* All listeners for this host */
TAILQ_HEAD(boundq, evhttp_bound_socket) sockets;
TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
+
+ /* All live connections on this host. */
struct evconq connections;
TAILQ_HEAD(vhostsq, evhttp) virtualhosts;
@@ -137,12 +142,16 @@ struct evhttp {
size_t default_max_headers_size;
ev_uint64_t default_max_body_size;
+ /* Fallback callback if all the other callbacks for this connection
+ don't match. */
void (*gencb)(struct evhttp_request *req, void *);
void *gencbarg;
struct event_base *base;
};
+/* XXX most of these functions could be static. */
+
/* resets the connection; can be reused for more requests */
void evhttp_connection_reset(struct evhttp_connection *);
@@ -153,18 +162,12 @@ int evhttp_connection_connect(struct evhttp_connection *);
void evhttp_connection_fail(struct evhttp_connection *,
enum evhttp_connection_error error);
-void evhttp_get_request(struct evhttp *, evutil_socket_t, struct sockaddr *, ev_socklen_t);
-
enum message_read_status;
enum message_read_status evhttp_parse_firstline(struct evhttp_request *, struct evbuffer*);
enum message_read_status evhttp_parse_headers(struct evhttp_request *, struct evbuffer*);
void evhttp_start_read(struct evhttp_connection *);
-void evhttp_make_header(struct evhttp_connection *, struct evhttp_request *);
-
-void evhttp_write_buffer(struct evhttp_connection *,
- void (*)(struct evhttp_connection *, void *), void *);
/* response sending HTML the data in the buffer */
void evhttp_response_code(struct evhttp_request *, int, const char *);