curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Status of IDN support?

From: Tim Rühsen <tim.ruehsen_at_gmx.de>
Date: Sat, 14 Jan 2017 16:17:14 +0100

On Samstag, 14. Januar 2017 14:36:51 CET Alessandro Ghedini wrote:
> On Fri, Jan 13, 2017 at 04:32:41PM +0100, Daniel Stenberg wrote:
> > On Thu, 12 Jan 2017, Daniel Stenberg wrote:
> > > IDN2_TRANSITIONAL feels like the way to go.
> >
> > FYI: Issue #1207 [*] has some further details on the back-and-forth that
> > happened in the git repo today, as we learned we actually need to set the
> > IDN2_NONTRANSITIONAL bit to have things working as we want to.
>
> I'm still seeing failure of test 165 locally.
>
> As for the other failures, it turns out I can only reproduce them when
> building inside a clean chroot (where the Debian package was built), so I'm
> guessing it could be an environment difference, or something like that.
>
> In any case I uploaded the new curl package despite the test failures to
> avoid getting caught in the freeze.
>
> Here is the output from test 165 failing btw:
>
> % ./runtests.pl 165
> ********* System characteristics ********
> * curl 7.52.2-DEV (x86_64-pc-linux-gnu)
> * libcurl/7.52.2-DEV OpenSSL/1.0.2j zlib/1.2.8 libidn2/0.14 libpsl/0.16.1
> (+libicu/57.1) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3 * Features: Debug
> TrackMemory IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2
> UnixSockets HTTPS-proxy PSL * Host: pinky
> * System: Linux pinky 4.8.0-2-amd64 #1 SMP Debian 4.8.15-2 (2017-01-04)
> x86_64 GNU/Linux * Servers: SSL HTTP-IPv6 HTTP-unix FTP-IPv6
> * Env: Valgrind
> *****************************************
> test 0165...[HTTP over proxy with IDN host name]
>
> 165: protocol FAILED:
> --- log/check-expected 2017-01-14 14:32:26.385723577 +0000
> +++ log/check-generated 2017-01-14 14:32:26.385723577 +0000
> @@ -1,10 +1,10 @@
> -GET http://www.xn--4cab6c.se/page/165 HTTP/1.1[CR][LF]
> -Host: www.xn--4cab6c.se[CR][LF]
> +GET http://www.%e5%e4%f6.se/page/165 HTTP/1.1[CR][LF]
> +Host: www.åäö.se[CR][LF]
> Accept: */*[CR][LF]
> Proxy-Connection: Keep-Alive[CR][LF]
> [CR][LF]
> -GET http://www.xn--groe-xna.de/page/165 HTTP/1.1[CR][LF]
> -Host: www.xn--groe-xna.de[CR][LF]
> +GET http://www.gro%dfe.de/page/165 HTTP/1.1[CR][LF]
> +Host: www.große.de[CR][LF]
> Accept: */*[CR][LF]
> Proxy-Connection: Keep-Alive[CR][LF]
> [CR][LF]
>
> - abort tests
> TESTDONE: 0 tests out of 1 reported OK: 0%
> TESTFAIL: These test cases failed: 165
> TESTDONE: 1 tests were considered during 3 seconds.

This patch fixes it for me (didn't test anything else but 165)

diff --git a/lib/url.c b/lib/url.c
index edae1e3f3..27dc4033d 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -4026,7 +4026,7 @@ static void fix_hostname(struct connectdata *conn, struct
hostname *host)
 #else
       int flags = IDN2_NFC_INPUT;
 #endif
- int rc = idn2_lookup_ul((const char *)host->name, &ace_hostname, flags);
+ int rc = idn2_lookup_u8((const char *)host->name, &ace_hostname, flags);
       if(rc == IDN2_OK) {
         host->encalloc = (char *)ace_hostname;
         /* change the name pointer to point to the encoded hostname */

The _ul lookup assumes that your input string is encoded with the current
locale. But if your string is already UTF-8, you should use the _u8 function.

I don't know how curl works internally, but it seems to be UTF-8...

Tim

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2017-01-14