From 262fb9356fe7da0378daca2464044ea1399b212b Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Sat, 11 Jul 2015 02:31:36 -0400 Subject: url: Don't pass UTF-8 hostname to libidn unless it's valid UTF-8. draft7 - Fix unit test. --- tests/unit/Makefile.inc | 1 - tests/unit/unit1603.c | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc index e1c1821e1..056a8fbf2 100644 --- a/tests/unit/Makefile.inc +++ b/tests/unit/Makefile.inc @@ -7,7 +7,6 @@ UNITFILES = curlcheck.h \ # These are all unit test programs UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307 \ unit1308 unit1309 unit1330 unit1394 unit1395 unit1396 unit1397 unit1398 \ - unit1600 unit1601 unit1602 unit1600 unit1601 unit1602 unit1603 unit1300_SOURCES = unit1300.c $(UNITFILES) diff --git a/tests/unit/unit1603.c b/tests/unit/unit1603.c index 00f68b0e3..752e679cd 100644 --- a/tests/unit/unit1603.c +++ b/tests/unit/unit1603.c @@ -24,17 +24,17 @@ #include "urldata.h" #include "non-ascii.h" -CURL *easy; +CURL *curl; static CURLcode unit_setup(void) { - easy = curl_easy_init(); + curl = curl_easy_init(); return CURLE_OK; } static void unit_stop(void) { - curl_easy_cleanup(easy); + curl_easy_cleanup(curl); } @@ -109,14 +109,13 @@ UNITTEST_START * hostname that contains invalid utf8, and verifying that we get back * an error that shows that our validation logic rejected it. */ - struct SessionHandle * curl; - CURLcode ret = Curl_open(&curl); - fail_unless(ret == 0, "serious error"); - ret = curl_easy_setopt(curl, CURLOPT_URL, "http://x\xC0\x80.com/"); - fail_unless(ret == 0, "shouldn't complain yet"); - ret = curl_easy_perform(curl); - fail_unless(ret != 0, "should get error about invalid hostname"); - /*printf("%s\n", curl_easy_strerror(ret));*/ + { + CURLcode ret; + ret = curl_easy_setopt(curl, CURLOPT_URL, "http://x\xC0\x80.com/"); + fail_unless(ret == 0, "shouldn't complain yet"); + ret = curl_easy_perform(curl); + fail_unless(ret == 6, "should get error about invalid hostname"); + } #else /*printf("test skipped; libidn not active\n");*/ #endif -- cgit v1.2.1