From 37e900936965862ef15c1dc5382b73cb11a059e7 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 10 Nov 2010 21:41:53 -0800 Subject: [PATCH] Digits in hostname on CONNECT req allowed --- http_parser.c | 3 +++ test.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/http_parser.c b/http_parser.c index 57633af..b119060 100644 --- a/http_parser.c +++ b/http_parser.c @@ -658,6 +658,9 @@ size_t http_parser_execute (http_parser *parser, } else if (ch == '.') { state = s_req_host; break; + } else if ('0' <= ch && ch <= '9') { + state = s_req_host; + break; } goto error; diff --git a/test.c b/test.c index c6f94fd..91a26ce 100644 --- a/test.c +++ b/test.c @@ -498,7 +498,7 @@ const struct message requests[] = #define CONNECT_REQUEST 17 , {.name = "connect request" ,.type= HTTP_REQUEST - ,.raw= "CONNECT home.netscape.com:443 HTTP/1.0\r\n" + ,.raw= "CONNECT home0.netscape.com:443 HTTP/1.0\r\n" "User-agent: Mozilla/1.1N\r\n" "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n" "\r\n" @@ -510,7 +510,7 @@ const struct message requests[] = ,.query_string= "" ,.fragment= "" ,.request_path= "" - ,.request_url= "home.netscape.com:443" + ,.request_url= "home0.netscape.com:443" ,.num_headers= 2 ,.upgrade=1 ,.headers= { { "User-agent", "Mozilla/1.1N" }