Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix IPv6 address parsing.

Fixes #133.
  • Loading branch information...
commit 1c7f8cac9ea328647558a42f24206f3ad5da24b7 1 parent cd01361
Corey Richardson cmr authored bnoordhuis committed
Showing with 20 additions and 1 deletion.
  1. +1 −1  http_parser.c
  2. +19 −0 test.c
2  http_parser.c
View
@@ -1962,7 +1962,7 @@ http_parse_host_char(enum http_host_state s, const char ch) {
/* FALLTHROUGH */
case s_http_host_v6_start:
- if (IS_HEX(ch) || ch == ':') {
+ if (IS_HEX(ch) || ch == ':' || ch == '.') {
return s_http_host_v6;
}
19 test.c
View
@@ -2214,6 +2214,25 @@ const struct url_test url_tests[] =
,.rv=0
}
+, {.name="ipv4 in ipv6 address"
+ ,.url="http://[2001:0000:0000:0000:0000:0000:1.9.1.1]/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 8, 37 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 46, 1 } /* 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,"
Please sign in to comment.
Something went wrong with that request. Please try again.