]> granicus.if.org Git - libevent/commitdiff
rename http.h to http-internal.h - i wish there were decent refactoring tools
authorNiels Provos <provos@gmail.com>
Sat, 10 Jun 2006 22:28:21 +0000 (22:28 +0000)
committerNiels Provos <provos@gmail.com>
Sat, 10 Jun 2006 22:28:21 +0000 (22:28 +0000)
for open source programmers.

svn:r213

Makefile.am
http-internal.h [new file with mode: 0644]
http.c
test/regress.c
test/regress_http.c

index c9ec048135e293c7a580bb14fdc6cbeabbef8c64..14ec3f66cc535a32e65f510094565ee26e819625 100644 (file)
@@ -24,7 +24,7 @@ EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \
 lib_LTLIBRARIES = libevent.la
 
 libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c event_tagging.c \
-        http.c http.h
+        http.c http-internal.h
 libevent_la_LIBADD = @LTLIBOBJS@
 libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:3:0
 
diff --git a/http-internal.h b/http-internal.h
new file mode 100644 (file)
index 0000000..29e87b2
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2001 Niels Provos <provos@citi.umich.edu>
+ * All rights reserved.
+ *
+ * This header file contains definitions for dealing with HTTP requests
+ * that are internal to libevent.  As user of the library, you should not
+ * need to know about these.
+ */
+
+#ifndef _HTTP_H_
+#define _HTTP_H_
+
+#define HTTP_CONNECT_TIMEOUT   45
+#define HTTP_WRITE_TIMEOUT     50
+#define HTTP_READ_TIMEOUT      50
+
+#define HTTP_PREFIX            "http://"
+#define HTTP_DEFAULTPORT       80
+
+struct evbuffer;
+struct addrinfo;
+
+/* A stupid connection object - maybe make this a bufferevent later */
+
+struct evhttp_connection {
+       int fd;
+       struct event ev;
+
+       char *address;
+       u_short port;
+       
+       void (*cb)(struct evhttp_connection *, void *);
+       void *cb_arg;
+};
+
+enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE };
+
+struct evhttp_request {
+       struct evkeyvalq *input_headers;
+       struct evkeyvalq *output_headers;
+
+       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 */
+
+       int fd;
+
+       struct event ev;
+
+       struct evbuffer *buffer;
+       int ntoread;
+
+       /* Callback */
+       void (*cb)(struct evhttp_request *, void *);
+       void *cb_arg;
+
+       void (*save_cb)(struct evhttp_request *, void *);
+       void *save_cbarg;
+};
+
+struct evhttp_cb {
+       TAILQ_ENTRY(evhttp_cb) next;
+
+       char *what;
+
+       void (*cb)(struct evhttp_request *req, void *);
+       void *cbarg;
+};
+
+struct evhttp {
+       struct event bind_ev;
+
+       TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
+
+       void (*gencb)(struct evhttp_request *req, void *);
+       void *gencbarg;
+};
+
+void evhttp_get_request(int, struct sockaddr *, socklen_t,
+    void (*)(struct evhttp_request *, void *), void *);
+
+/*
+ * Starts a connection to the specified address and invokes the callback
+ * if everything is fine.
+ */
+struct evhttp_connection *evhttp_connect(
+       const char *address, unsigned short port,
+       void (*cb)(struct evhttp_connection *, void *), void *cb_arg);
+
+/* Frees an http connection */
+void evhttp_connection_free(struct evhttp_connection *evcon);
+
+int evhttp_make_request(struct evhttp_connection *evcon,
+    struct evhttp_request *req,
+    enum evhttp_cmd_type type, const char *uri);
+
+int evhttp_hostportfile(char *, char **, u_short *, char **);
+
+int evhttp_parse_lines(struct evhttp_request *, struct evbuffer*);
+
+void evhttp_start_read(struct evhttp_request *);
+void evhttp_read_header(int, short, void *);
+void evhttp_make_header(struct evbuffer *, struct evhttp_request *);
+
+void evhttp_form_response(struct evbuffer *, struct evhttp_request *);
+void evhttp_write_buffer(struct evhttp_request *, struct evbuffer *,
+    void (*)(struct evhttp_request *, void *), void *);
+
+/* response sending HTML the data in the buffer */
+void evhttp_response_code(struct evhttp_request *, int, const char *);
+void evhttp_send_page(struct evhttp_request *, struct evbuffer *);
+void evhttp_fail(struct evhttp_request *);
+
+#endif /* _HTTP_H */
diff --git a/http.c b/http.c
index 9ff4dc4aaa9a31d81aab2350b4eb2871cc7f19d2..61f3b70ff994b6d114231cf7b314cd6237993d92 100644 (file)
--- a/http.c
+++ b/http.c
@@ -67,7 +67,7 @@
 
 #include "event.h"
 #include "log.h"
-#include "http.h"
+#include "http-internal.h"
 
 extern int debug;
 
index 3f5158385c31cdc8c8c57a910a7233ad83a03bb6..32f2f2f6fc5f62a010daeeabfd5fc7e039423321 100644 (file)
@@ -54,7 +54,7 @@
 
 #include "event.h"
 #include "log.h"
-#include "http.h"
+#include "http-internal.h"
 
 #include "regress.h"
 #include "regress.gen.h"
index f96fa69d89d1e43b88938ba0a9c9be6bf3558e28..8801bb21f65dd70e2f1aa8adf1b69ee7850c5db9 100644 (file)
@@ -54,7 +54,7 @@
 
 #include "event.h"
 #include "log.h"
-#include "http.h"
+#include "http-internal.h"
 
 extern int pair[];
 extern int test_ok;