dovecot-2.2: lib-http: test-http-url - add some tricky invalid n...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jul 2 15:23:26 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/a39ccb12c14f
changeset: 17560:a39ccb12c14f
user:      Phil Carmody <phil at dovecot.fi>
date:      Wed Jul 02 18:21:24 2014 +0300
description:
lib-http: test-http-url - add some tricky invalid numeric hostname URLs
Try to get the numeric octet parser to fail. The RFCs specify that we should
fall back onto parsing them as domain names instead, and hence the unexpected
legitimacy of out-of-range numbers.

NOTE: This causes make check to report the following error:
http url valid [11]: http_url_parse(http://127.0.0.284/this/also/reverts/to/DNS)  : ok
test-http-url.c:328: Assert failed: urlp->have_host_ip == urlt->have_host_ip
http url valid [11] .................................................. : FAILED

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib-http/test-http-url.c |  20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diffs (30 lines):

diff -r 659ea72a82aa -r a39ccb12c14f src/lib-http/test-http-url.c
--- a/src/lib-http/test-http-url.c	Wed Jul 02 18:21:24 2014 +0300
+++ b/src/lib-http/test-http-url.c	Wed Jul 02 18:21:24 2014 +0300
@@ -72,6 +72,26 @@
 			.host_name = "www.example.com",
 			.enc_query = "question=What%20are%20you%20doing%3f&answer=Nothing." }
 	},{
+		/* These next 2 URLs don't follow the recommendations in
+		   http://tools.ietf.org/html/rfc1034#section-3.5 and
+		   http://tools.ietf.org/html/rfc3696
+		   However they satisfy the grammar in
+		   http://tools.ietf.org/html/rfc1123#section-2 and
+		   http://tools.ietf.org/html/rfc952
+		   so we should parse them.
+		*/
+		.url = "http://256.0.0.1/that/reverts/to/DNS",
+		.url_parsed = {
+			.path = "/that/reverts/to/DNS",
+			.host_name = "256.0.0.1"
+		}
+	},{
+		.url = "http://127.0.0.284/this/also/reverts/to/DNS",
+		.url_parsed = {
+			.path = "/this/also/reverts/to/DNS",
+			.host_name = "127.0.0.284"
+		}
+	},{
 		.url = "http://www.example.com/#Status%20of%20development",
 		.flags = HTTP_URL_ALLOW_FRAGMENT_PART,
 		.url_parsed = {


More information about the dovecot-cvs mailing list