summaryrefslogtreecommitdiff
path: root/src/connections.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/connections.c')
-rw-r--r--src/connections.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/connections.c b/src/connections.c
index acd8880..ea3a66c 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -352,7 +352,13 @@ static int connection_handle_write_prepare(server *srv, connection *con) {
case HTTP_METHOD_PROPPATCH:
break;
case HTTP_METHOD_OPTIONS:
- if (con->uri.path->ptr[0] != '*') {
+ /*
+ * 400 is coming from the request-parser BEFORE uri.path is set
+ * 403 is from the response handler when noone else catched it
+ *
+ * */
+ if (con->uri.path->used &&
+ con->uri.path->ptr[0] != '*') {
response_header_insert(srv, con, CONST_STR_LEN("Allow"), CONST_STR_LEN("OPTIONS, GET, HEAD, POST"));
con->http_status = 200;
@@ -364,6 +370,7 @@ static int connection_handle_write_prepare(server *srv, connection *con) {
default:
switch(con->http_status) {
case 400: /* bad request */
+ case 414: /* overload request header */
case 505: /* unknown protocol */
case 207: /* this was webdav */
break;
@@ -864,6 +871,7 @@ int connection_handle_read_state(server *srv, connection *con) {
c->next = cq->unused;
cq->unused = c;
+ cq->unused_chunks++;
c = cq->first;
} else if (c->next && c->next->mem->used == 0) {
@@ -876,6 +884,7 @@ int connection_handle_read_state(server *srv, connection *con) {
fc->next = cq->unused;
cq->unused = fc;
+ cq->unused_chunks++;
/* the last node was empty */
if (c->next == NULL) {
@@ -981,11 +990,11 @@ int connection_handle_read_state(server *srv, connection *con) {
if (h_term) {
connection_set_state(srv, con, CON_STATE_REQUEST_END);
} else if (con->request.request->used > 64 * 1024) {
- log_error_write(srv, __FILE__, __LINE__, "sd", "http-header larger then 64k -> disconnected", chunkqueue_length(cq));
+ log_error_write(srv, __FILE__, __LINE__, "s", "oversized request-header -> sending Status 414");
con->http_status = 414; /* Request-URI too large */
con->keep_alive = 0;
- connection_set_state(srv, con, CON_STATE_REQUEST_END);
+ connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
}
break;
case CON_STATE_READ_POST: