Don't assert that requests have a host header
This commit is contained in:
@@ -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)
|
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"));
|
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];
|
char tmp[1<<8];
|
||||||
if (port > -1 && port != 80) {
|
if (port > -1 && port != 80) {
|
||||||
|
|||||||
+3
-2
@@ -1,2 +1,3 @@
|
|||||||
- Per RFC 6265, cookie values can be quoted. This parser would include the quotes in the value.
|
[ ] 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
|
[ ] Return an appropriate error code when the user waits on a client with no pending requests
|
||||||
|
[ ] Add connection reuse limit
|
||||||
+2
-1
@@ -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)
|
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"));
|
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];
|
char tmp[1<<8];
|
||||||
if (port > -1 && port != 80) {
|
if (port > -1 && port != 80) {
|
||||||
|
|||||||
Reference in New Issue
Block a user