Skip to content

Commit

Permalink
Support request URLs without schema
Browse files Browse the repository at this point in the history
Test case from Poul T Lomholt <[email protected]>
  • Loading branch information
ry committed Jun 6, 2010
1 parent cdda8b6 commit 4cf39fd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 24 additions & 0 deletions test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

Expand Down

0 comments on commit 4cf39fd

Please sign in to comment.