allow extra ? at the beginning of a query_string.

fixes joyent/http-parser issue #25
v0.10
David Gwynne 13 years ago committed by Ben Noordhuis
parent 8da60bc423
commit 67568421e9

@ -535,30 +535,15 @@ parse_url_char(enum state s, const char ch)
break;
case s_req_query_string_start:
if (IS_URL_CHAR(ch)) {
return s_req_query_string;
}
switch (ch) {
case '?':
/* XXX ignore extra '?' ... is this right? */
return s;
case '#':
return s_req_fragment_start;
}
break;
case s_req_query_string:
if (IS_URL_CHAR(ch)) {
return s;
return s_req_query_string;
}
switch (ch) {
case '?':
/* allow extra '?' in query string */
return s;
return s_req_query_string;
case '#':
return s_req_fragment_start;

@ -1985,6 +1985,24 @@ const struct url_test url_tests[] =
,.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"
,.is_connect=0
,.u=
{.field_set=(1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_QUERY)
,.port=0
,.field_data=
{{ 0, 4 } /* UF_SCHEMA */
,{ 7, 10 } /* UF_HOST */
,{ 0, 0 } /* UF_PORT */
,{ 17, 12 } /* UF_PATH */
,{ 30,187 } /* UF_QUERY */
,{ 0, 0 } /* UF_FRAGMENT */
}
}
,.rv=0
}
, {.name="proxy empty host"
,.url="http://:443/"
,.is_connect=1

Loading…
Cancel
Save