|
|
|
@ -50,6 +50,8 @@ struct message {
|
|
|
|
|
char query_string[MAX_ELEMENT_SIZE];
|
|
|
|
|
char body[MAX_ELEMENT_SIZE];
|
|
|
|
|
size_t body_size;
|
|
|
|
|
const char *host;
|
|
|
|
|
const char *userinfo;
|
|
|
|
|
uint16_t port;
|
|
|
|
|
int num_headers;
|
|
|
|
|
enum { NONE=0, FIELD, VALUE } last_header_element;
|
|
|
|
@ -630,6 +632,7 @@ const struct message requests[] =
|
|
|
|
|
,.fragment= ""
|
|
|
|
|
,.request_path= ""
|
|
|
|
|
,.request_url= "http://hypnotoad.org?hail=all"
|
|
|
|
|
,.host= "hypnotoad.org"
|
|
|
|
|
,.num_headers= 0
|
|
|
|
|
,.headers= { }
|
|
|
|
|
,.body= ""
|
|
|
|
@ -649,6 +652,7 @@ const struct message requests[] =
|
|
|
|
|
,.fragment= ""
|
|
|
|
|
,.request_path= ""
|
|
|
|
|
,.request_url= "http://hypnotoad.org:1234?hail=all"
|
|
|
|
|
,.host= "hypnotoad.org"
|
|
|
|
|
,.port= 1234
|
|
|
|
|
,.num_headers= 0
|
|
|
|
|
,.headers= { }
|
|
|
|
@ -669,6 +673,7 @@ const struct message requests[] =
|
|
|
|
|
,.fragment= ""
|
|
|
|
|
,.request_path= ""
|
|
|
|
|
,.request_url= "http://hypnotoad.org:1234"
|
|
|
|
|
,.host= "hypnotoad.org"
|
|
|
|
|
,.port= 1234
|
|
|
|
|
,.num_headers= 0
|
|
|
|
|
,.headers= { }
|
|
|
|
@ -870,6 +875,28 @@ const struct message requests[] =
|
|
|
|
|
,.body= ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define PROXY_WITH_BASIC_AUTH 33
|
|
|
|
|
, {.name= "host:port and basic_auth"
|
|
|
|
|
,.type= HTTP_REQUEST
|
|
|
|
|
,.raw= "GET http://a%12:b!&*$@hypnotoad.org:1234/toto HTTP/1.1\r\n"
|
|
|
|
|
"\r\n"
|
|
|
|
|
,.should_keep_alive= TRUE
|
|
|
|
|
,.message_complete_on_eof= FALSE
|
|
|
|
|
,.http_major= 1
|
|
|
|
|
,.http_minor= 1
|
|
|
|
|
,.method= HTTP_GET
|
|
|
|
|
,.fragment= ""
|
|
|
|
|
,.request_path= "/toto"
|
|
|
|
|
,.request_url= "http://a%12:b!&*$@hypnotoad.org:1234/toto"
|
|
|
|
|
,.host= "hypnotoad.org"
|
|
|
|
|
,.userinfo= "a%12:b!&*$"
|
|
|
|
|
,.port= 1234
|
|
|
|
|
,.num_headers= 0
|
|
|
|
|
,.headers= { }
|
|
|
|
|
,.body= ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, {.name= NULL } /* sentinel */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -1794,6 +1821,14 @@ message_eq (int index, const struct message *expected)
|
|
|
|
|
abort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (expected->host) {
|
|
|
|
|
MESSAGE_CHECK_URL_EQ(&u, expected, m, host, UF_HOST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (expected->userinfo) {
|
|
|
|
|
MESSAGE_CHECK_URL_EQ(&u, expected, m, userinfo, UF_USERINFO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m->port = (u.field_set & (1 << UF_PORT)) ?
|
|
|
|
|
u.port : 0;
|
|
|
|
|
|
|
|
|
@ -1966,6 +2001,26 @@ const struct url_test url_tests[] =
|
|
|
|
|
,{ 15, 1 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy request with port"
|
|
|
|
|
,.url="http://hostname:444/"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PORT) | (1 << UF_PATH)
|
|
|
|
|
,.port=444
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 7, 8 } /* UF_HOST */
|
|
|
|
|
,{ 16, 3 } /* UF_PORT */
|
|
|
|
|
,{ 19, 1 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
@ -1984,11 +2039,18 @@ const struct url_test url_tests[] =
|
|
|
|
|
,{ 0, 0 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="CONNECT request but not connect"
|
|
|
|
|
,.url="hostname:443"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.rv=1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy ipv6 request"
|
|
|
|
|
,.url="http://[1:2::3:4]/"
|
|
|
|
|
,.is_connect=0
|
|
|
|
@ -2002,6 +2064,26 @@ const struct url_test url_tests[] =
|
|
|
|
|
,{ 17, 1 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy ipv6 request with port"
|
|
|
|
|
,.url="http://[1:2::3:4]:67/"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PORT) | (1 << UF_PATH)
|
|
|
|
|
,.port=67
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 8, 8 } /* UF_HOST */
|
|
|
|
|
,{ 18, 2 } /* UF_PORT */
|
|
|
|
|
,{ 20, 1 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
@ -2020,13 +2102,16 @@ const struct url_test url_tests[] =
|
|
|
|
|
,{ 0, 0 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="extra ? in query string"
|
|
|
|
|
,.url="http://a.tbcdn.cn/p/fp/2010c/??fp-header-min.css,fp-base-min.css,fp-channel-min.css,fp-product-min.css,fp-mall-min.css,fp-category-min.css,fp-sub-min.css,fp-gdp4p-min.css,fp-css3-min.css,fp-misc-min.css?t=20101022.css"
|
|
|
|
|
,.url="http://a.tbcdn.cn/p/fp/2010c/??fp-header-min.css,fp-base-min.css,"
|
|
|
|
|
"fp-channel-min.css,fp-product-min.css,fp-mall-min.css,fp-category-min.css,"
|
|
|
|
|
"fp-sub-min.css,fp-gdp4p-min.css,fp-css3-min.css,fp-misc-min.css?t=20101022.css"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set=(1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_QUERY)
|
|
|
|
@ -2038,11 +2123,118 @@ const struct url_test url_tests[] =
|
|
|
|
|
,{ 17, 12 } /* UF_PATH */
|
|
|
|
|
,{ 30,187 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="space URL encoded"
|
|
|
|
|
,.url="/toto.html?toto=a%20b"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_PATH) | (1<<UF_QUERY)
|
|
|
|
|
,.port=0
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 0 } /* UF_SCHEMA */
|
|
|
|
|
,{ 0, 0 } /* UF_HOST */
|
|
|
|
|
,{ 0, 0 } /* UF_PORT */
|
|
|
|
|
,{ 0, 10 } /* UF_PATH */
|
|
|
|
|
,{ 11, 10 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, {.name="URL fragment"
|
|
|
|
|
,.url="/toto.html#titi"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_PATH) | (1<<UF_FRAGMENT)
|
|
|
|
|
,.port=0
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 0 } /* UF_SCHEMA */
|
|
|
|
|
,{ 0, 0 } /* UF_HOST */
|
|
|
|
|
,{ 0, 0 } /* UF_PORT */
|
|
|
|
|
,{ 0, 10 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 11, 4 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="complex URL fragment"
|
|
|
|
|
,.url="http://www.webmasterworld.com/r.cgi?f=21&d=8405&url="
|
|
|
|
|
"http://www.example.com/index.html?foo=bar&hello=world#midpage"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_QUERY) |\
|
|
|
|
|
(1<<UF_FRAGMENT)
|
|
|
|
|
,.port=0
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 7, 22 } /* UF_HOST */
|
|
|
|
|
,{ 0, 0 } /* UF_PORT */
|
|
|
|
|
,{ 29, 6 } /* UF_PATH */
|
|
|
|
|
,{ 36, 69 } /* UF_QUERY */
|
|
|
|
|
,{106, 7 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="complex URL from node js url parser doc"
|
|
|
|
|
,.url="http://host.com:8080/p/a/t/h?query=string#hash"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PORT) | (1<<UF_PATH) |\
|
|
|
|
|
(1<<UF_QUERY) | (1<<UF_FRAGMENT)
|
|
|
|
|
,.port=8080
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 7, 8 } /* UF_HOST */
|
|
|
|
|
,{ 16, 4 } /* UF_PORT */
|
|
|
|
|
,{ 20, 8 } /* UF_PATH */
|
|
|
|
|
,{ 29, 12 } /* UF_QUERY */
|
|
|
|
|
,{ 42, 4 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="complex URL with basic auth from node js url parser doc"
|
|
|
|
|
,.url="http://a:b@host.com:8080/p/a/t/h?query=string#hash"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PORT) | (1<<UF_PATH) |\
|
|
|
|
|
(1<<UF_QUERY) | (1<<UF_FRAGMENT) | (1<<UF_USERINFO)
|
|
|
|
|
,.port=8080
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 11, 8 } /* UF_HOST */
|
|
|
|
|
,{ 20, 4 } /* UF_PORT */
|
|
|
|
|
,{ 24, 8 } /* UF_PATH */
|
|
|
|
|
,{ 33, 12 } /* UF_QUERY */
|
|
|
|
|
,{ 46, 4 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 7, 3 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="double @"
|
|
|
|
|
,.url="http://a:b@@hostname:443/"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.rv=1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy empty host"
|
|
|
|
|
,.url="http://:443/"
|
|
|
|
|
,.is_connect=0
|
|
|
|
@ -2055,6 +2247,12 @@ const struct url_test url_tests[] =
|
|
|
|
|
,.rv=1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="CONNECT with basic auth"
|
|
|
|
|
,.url="a:b@hostname:443"
|
|
|
|
|
,.is_connect=1
|
|
|
|
|
,.rv=1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="CONNECT empty host"
|
|
|
|
|
,.url=":443"
|
|
|
|
|
,.is_connect=1
|
|
|
|
@ -2078,16 +2276,130 @@ const struct url_test url_tests[] =
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy basic auth with space url encoded"
|
|
|
|
|
,.url="http://a%20:b@host.com/"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
|
|
|
|
|
,.port=0
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 14, 8 } /* UF_HOST */
|
|
|
|
|
,{ 0, 0 } /* UF_PORT */
|
|
|
|
|
,{ 22, 1 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 7, 6 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="carriage return in URL"
|
|
|
|
|
,.url="/foo\rbar/"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy double : in URL"
|
|
|
|
|
,.url="http://hostname::443/"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy basic auth with double :"
|
|
|
|
|
,.url="http://a::b@host.com/"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
|
|
|
|
|
,.port=0
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 12, 8 } /* UF_HOST */
|
|
|
|
|
,{ 0, 0 } /* UF_PORT */
|
|
|
|
|
,{ 20, 1 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 7, 4 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="line feed in URL"
|
|
|
|
|
,.url="/foo\nbar/"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy empty basic auth"
|
|
|
|
|
,.url="http://@hostname/fo"
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH)
|
|
|
|
|
,.port=0
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 8, 8 } /* UF_HOST */
|
|
|
|
|
,{ 0, 0 } /* UF_PORT */
|
|
|
|
|
,{ 16, 3 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
, {.name="proxy line feed in hostname"
|
|
|
|
|
,.url="http://host\name/fo"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy % in hostname"
|
|
|
|
|
,.url="http://host%name/fo"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy ; in hostname"
|
|
|
|
|
,.url="http://host;ame/fo"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy basic auth with unreservedchars"
|
|
|
|
|
,.url="http://a!;-_!=+$@host.com/"
|
|
|
|
|
,.is_connect=0
|
|
|
|
|
,.u=
|
|
|
|
|
{.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
|
|
|
|
|
,.port=0
|
|
|
|
|
,.field_data=
|
|
|
|
|
{{ 0, 4 } /* UF_SCHEMA */
|
|
|
|
|
,{ 17, 8 } /* UF_HOST */
|
|
|
|
|
,{ 0, 0 } /* UF_PORT */
|
|
|
|
|
,{ 25, 1 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 7, 9 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy only empty basic auth"
|
|
|
|
|
,.url="http://@/fo"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy only basic auth"
|
|
|
|
|
,.url="http://toto@/fo"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy emtpy hostname"
|
|
|
|
|
,.url="http:///fo"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {.name="proxy = in URL"
|
|
|
|
|
,.url="http://host=ame/fo"
|
|
|
|
|
,.rv=1 /* s_dead */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if HTTP_PARSER_STRICT
|
|
|
|
|
|
|
|
|
|
, {.name="tab in URL"
|
|
|
|
@ -2113,6 +2425,7 @@ const struct url_test url_tests[] =
|
|
|
|
|
,{ 0, 9 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
@ -2129,6 +2442,7 @@ const struct url_test url_tests[] =
|
|
|
|
|
,{ 0, 9 } /* UF_PATH */
|
|
|
|
|
,{ 0, 0 } /* UF_QUERY */
|
|
|
|
|
,{ 0, 0 } /* UF_FRAGMENT */
|
|
|
|
|
,{ 0, 0 } /* UF_USERINFO */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
,.rv=0
|
|
|
|
@ -2139,7 +2453,6 @@ const struct url_test url_tests[] =
|
|
|
|
|
void
|
|
|
|
|
dump_url (const char *url, const struct http_parser_url *u)
|
|
|
|
|
{
|
|
|
|
|
char part[512];
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
printf("\tfield_set: 0x%x, port: %u\n", u->field_set, u->port);
|
|
|
|
@ -2149,14 +2462,12 @@ dump_url (const char *url, const struct http_parser_url *u)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy(part, url + u->field_data[i].off, u->field_data[i].len);
|
|
|
|
|
part[u->field_data[i].len] = '\0';
|
|
|
|
|
|
|
|
|
|
printf("\tfield_data[%u]: off: %u len: %u part: \"%s\"\n",
|
|
|
|
|
printf("\tfield_data[%u]: off: %u len: %u part: \"%.*s\n",
|
|
|
|
|
i,
|
|
|
|
|
u->field_data[i].off,
|
|
|
|
|
u->field_data[i].len,
|
|
|
|
|
part);
|
|
|
|
|
u->field_data[i].len,
|
|
|
|
|
url + u->field_data[i].off);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|