summaryrefslogtreecommitdiff
path: root/http-internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'http-internal.h')
-rw-r--r--http-internal.h49
1 files changed, 8 insertions, 41 deletions
diff --git a/http-internal.h b/http-internal.h
index f5ad2861..17015e1e 100644
--- a/http-internal.h
+++ b/http-internal.h
@@ -30,6 +30,9 @@ enum evhttp_connection_state {
};
struct evhttp_connection {
+ /* we use tailq only if they were created for an http server */
+ TAILQ_ENTRY(evhttp_connection) next;
+
int fd;
struct event ev;
struct evbuffer *input_buffer;
@@ -44,51 +47,15 @@ struct evhttp_connection {
enum evhttp_connection_state state;
+ /* for server connections, the http server they are connected with */
+ struct evhttp *http_server;
+
TAILQ_HEAD(evcon_requestq, evhttp_request) requests;
void (*cb)(struct evhttp_connection *, void *);
void *cb_arg;
};
-enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE };
-
-struct evhttp_request {
- TAILQ_ENTRY(evhttp_request) next;
-
- /* the connection object that this request belongs to */
- struct evhttp_connection *evcon;
- int flags;
-#define EVHTTP_REQ_OWN_CONNECTION 0x0001
-
- struct evkeyvalq *input_headers;
- struct evkeyvalq *output_headers;
-
- /* xxx: do we still need these? */
- char *remote_host;
- u_short remote_port;
-
- enum evhttp_request_kind kind;
- enum evhttp_cmd_type type;
-
- char *uri; /* uri after HTTP request was parsed */
-
- char major; /* HTTP Major number */
- char minor; /* HTTP Minor number */
-
- int got_firstline;
- int response_code; /* HTTP Response code */
- char *response_code_line; /* Readable response */
-
- struct evbuffer *input_buffer; /* read data */
- int ntoread;
-
- struct evbuffer *output_buffer; /* outgoing post or data */
-
- /* Callback */
- void (*cb)(struct evhttp_request *, void *);
- void *cb_arg;
-};
-
struct evhttp_cb {
TAILQ_ENTRY(evhttp_cb) next;
@@ -102,6 +69,7 @@ struct evhttp {
struct event bind_ev;
TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
+ TAILQ_HEAD(evconq, evhttp_connection) connections;
void (*gencb)(struct evhttp_request *req, void *);
void *gencbarg;
@@ -116,8 +84,7 @@ int evhttp_connection_connect(struct evhttp_connection *);
/* notifies the current request that it failed; resets connection */
void evhttp_connection_fail(struct evhttp_connection *);
-void evhttp_get_request(int, struct sockaddr *, socklen_t,
- void (*)(struct evhttp_request *, void *), void *);
+void evhttp_get_request(struct evhttp *, int, struct sockaddr *, socklen_t);
int evhttp_hostportfile(char *, char **, u_short *, char **);