From 4cf39fd2fa8d1b52338ad3c4dd9ae6b3f32d72f4 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 6 Jun 2010 16:18:09 -0700 Subject: [PATCH] Support request URLs without schema Test case from Poul T Lomholt --- http_parser.c | 3 +++ test.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/http_parser.c b/http_parser.c index 95fa864..7556d92 100644 --- a/http_parser.c +++ b/http_parser.c @@ -687,6 +687,9 @@ size_t http_parser_execute (http_parser *parser, if (ch == ':') { state = s_req_schema_slash; break; + } else if (ch == '.') { + state = s_req_host; + break; } goto error; diff --git a/test.c b/test.c index 5d9e589..a9746ad 100644 --- a/test.c +++ b/test.c @@ -495,6 +495,30 @@ const struct message requests[] = ,.body= "" } +#define CONNECT_REQUEST 17 +, {.name = "connect request" + ,.type= HTTP_REQUEST + ,.raw= "CONNECT home.netscape.com:443 HTTP/1.0\r\n" + "User-agent: Mozilla/1.1N\r\n" + "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.method= HTTP_CONNECT + ,.query_string= "" + ,.fragment= "" + ,.request_path= "" + ,.request_url= "home.netscape.com:443" + ,.num_headers= 2 + ,.upgrade=0 + ,.headers= { { "User-agent", "Mozilla/1.1N" } + , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" } + } + ,.body= "" + } + , {.name= NULL } /* sentinel */ };