0
static int server_socket_unix(const char *path, int access_mask);
0
-static void env_add(ebb_client *client, const char *field, int flen, const char *value, int vlen)
0
+void env_add(ebb_client *client, const char *field, int flen, const char *value, int vlen)
0
if(client->env_size >= EBB_MAX_ENV) {
0
client->parser.overflow_error = TRUE;
0
@@ -46,7 +46,7 @@ static void env_add(ebb_client *client, const char *field, int flen, const char
0
-static void env_add_const(ebb_client *client, int type, const char *value, int vlen)
0
+void env_add_const(ebb_client *client, int type, const char *value, int vlen)
0
if(client->env_size >= EBB_MAX_ENV) {
0
client->parser.overflow_error = TRUE;
0
@@ -61,7 +61,7 @@ static void env_add_const(ebb_client *client, int type, const char *value, int v
0
-static void http_field_cb(void *data, const char *field, size_t flen, const char *value, size_t vlen)
0
+void http_field_cb(void *data, const char *field, size_t flen, const char *value, size_t vlen)
0
ebb_client *client = (ebb_client*)(data);
0
@@ -70,60 +70,60 @@ static void http_field_cb(void *data, const char *field, size_t flen, const char
0
-static void request_method_cb(void *data, const char *at, size_t length)
0
+void request_method_cb(void *data, const char *at, size_t length)
0
ebb_client *client = (ebb_client*)(data);
0
env_add_const(client, EBB_REQUEST_METHOD, at, length);
0
-static void request_uri_cb(void *data, const char *at, size_t length)
0
+void request_uri_cb(void *data, const char *at, size_t length)
0
ebb_client *client = (ebb_client*)(data);
0
env_add_const(client, EBB_REQUEST_URI, at, length);
0
-static void fragment_cb(void *data, const char *at, size_t length)
0
+void fragment_cb(void *data, const char *at, size_t length)
0
ebb_client *client = (ebb_client*)(data);
0
env_add_const(client, EBB_FRAGMENT, at, length);
0
-static void request_path_cb(void *data, const char *at, size_t length)
0
+void request_path_cb(void *data, const char *at, size_t length)
0
ebb_client *client = (ebb_client*)(data);
0
env_add_const(client, EBB_REQUEST_PATH, at, length);
0
-static void query_string_cb(void *data, const char *at, size_t length)
0
+void query_string_cb(void *data, const char *at, size_t length)
0
ebb_client *client = (ebb_client*)(data);
0
env_add_const(client, EBB_QUERY_STRING, at, length);
0
-static void http_version_cb(void *data, const char *at, size_t length)
0
+void http_version_cb(void *data, const char *at, size_t length)
0
ebb_client *client = (ebb_client*)(data);
0
env_add_const(client, EBB_HTTP_VERSION, at, length);
0
-static void content_length_cb(void *data, const char *at, size_t length)
0
+void content_length_cb(void *data, const char *at, size_t length)
0
ebb_client *client = (ebb_client*)(data);
0
env_add_const(client, EBB_CONTENT_LENGTH, at, length);
0
/* atoi_length - why isn't this in the statndard library? i hate c */
0
+ assert(client->content_length == 0);
0
for(mult=1, i=length-1; i>=0; i--, mult*=10)
0
client->content_length += (at[i] - '0') * mult;
0
-const char* localhost_str = "0.0.0.0";
0
static void dispatch(ebb_client *client)
0
ebb_server *server = client->server;
0
@@ -133,10 +133,6 @@ static void dispatch(ebb_client *client)
0
/* Set the env variables */
0
- env_add_const(client, EBB_SERVER_NAME
0
env_add_const(client, EBB_SERVER_PORT
0
@@ -291,17 +287,17 @@ static client_init(ebb_server *server, ebb_client *client)
0
for(i=0; i< EBB_BUFFERSIZE; i++)
0
client->request_buffer[i] = 'A';
0
client->server = server;
0
client->fd = accept(server->fd, (struct sockaddr*)&(server->sockaddr), &len);
0
assert(client->fd >= 0);
0
int flags = fcntl(client->fd, F_GETFL, 0);
0
assert(0 <= fcntl(client->fd, F_SETFL, flags | O_NONBLOCK));
0
/* INITIALIZE http_parser */
0
http_parser_init(&(client->parser));
0
client->parser.data = client;
0
@@ -313,25 +309,24 @@ static client_init(ebb_server *server, ebb_client *client)
0
client->parser.query_string = query_string_cb;
0
client->parser.http_version = http_version_cb;
0
client->parser.content_length = content_length_cb;
0
client->read = client->nread_from_body = 0;
0
client->response_buffer->len = 0; /* see note in ebb_client_close */
0
client->content_length = 0;
0
client->status_written = FALSE;
0
client->headers_written = FALSE;
0
client->body_written = FALSE;
0
client->began_transmission = FALSE;
0
/* SETUP READ AND TIMEOUT WATCHERS */
0
client->read_watcher.data = client;
0
ev_init(&client->read_watcher, on_readable);
0
ev_io_set(&client->read_watcher, client->fd, EV_READ | EV_ERROR);
0
ev_io_start(server->loop, &client->read_watcher);
0
client->timeout_watcher.data = client;
0
ev_timer_init(&client->timeout_watcher, on_timeout, EBB_TIMEOUT, EBB_TIMEOUT);
0
ev_timer_start(server->loop, &client->timeout_watcher);
Comments
No one has commented yet.