summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2015-07-11 02:31:36 -0400
committerJay Satiro <raysatiro@yahoo.com>2015-07-11 02:31:36 -0400
commit262fb9356fe7da0378daca2464044ea1399b212b (patch)
tree5a47ad90ea82036913d776f9a16f12a6b567dc32
parentc9fb473ed2b44b765eebbf738a511f2f46371e89 (diff)
downloadcurl-check_utf8_before_libidn.tar.gz
url: Don't pass UTF-8 hostname to libidn unless it's valid UTF-8. draft7check_utf8_before_libidn
- Fix unit test.
-rw-r--r--tests/unit/Makefile.inc1
-rw-r--r--tests/unit/unit1603.c21
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