diff --git a/chttp.c b/chttp.c index 43d1778..ec62d36 100644 --- a/chttp.c +++ b/chttp.c @@ -1434,7 +1434,8 @@ int chttp_get_param_i(CHTTP_String body, CHTTP_String str) bool chttp_match_host(CHTTP_Request *req, CHTTP_String domain, int port) { int idx = chttp_find_header(req->headers, req->num_headers, CHTTP_STR("Host")); - assert(idx != -1); // Requests without the host header are always rejected + if (idx < 0) + return false; char tmp[1<<8]; if (port > -1 && port != 80) { diff --git a/misc/TODO.txt b/misc/TODO.txt index c632eef..2876783 100644 --- a/misc/TODO.txt +++ b/misc/TODO.txt @@ -1,2 +1,3 @@ -- Per RFC 6265, cookie values can be quoted. This parser would include the quotes in the value. -- Return an appropriate error code when the user waits on a client with no pending requests +[ ] Per RFC 6265, cookie values can be quoted. This parser would include the quotes in the value. +[ ] Return an appropriate error code when the user waits on a client with no pending requests +[ ] Add connection reuse limit \ No newline at end of file diff --git a/src/parse.c b/src/parse.c index 21d6dd7..ef255fc 100644 --- a/src/parse.c +++ b/src/parse.c @@ -1308,7 +1308,8 @@ int chttp_get_param_i(CHTTP_String body, CHTTP_String str) bool chttp_match_host(CHTTP_Request *req, CHTTP_String domain, int port) { int idx = chttp_find_header(req->headers, req->num_headers, CHTTP_STR("Host")); - assert(idx != -1); // Requests without the host header are always rejected + if (idx < 0) + return false; char tmp[1<<8]; if (port > -1 && port != 80) {