|
|
b07f02 |
From 496afe1f27481eb45ac14df0bfdb287b95eefbdd Mon Sep 17 00:00:00 2001
|
|
|
b07f02 |
From: Robert Scheck <redhat-bugzilla@linuxnetz.de>
|
|
|
b07f02 |
Date: Fri, 30 May 2014 15:28:54 +0200
|
|
|
b07f02 |
Subject: [PATCH] Add support for GNU Libidn2
|
|
|
b07f02 |
MIME-Version: 1.0
|
|
|
b07f02 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b07f02 |
Content-Transfer-Encoding: 8bit
|
|
|
b07f02 |
|
|
|
b07f02 |
Patch by Robert Scheck <robert@fedoraproject.org> for elinks >= 0.12 which replaces current
|
|
|
b07f02 |
GNU Libidn support (IDNA 2003) by GNU Libidn2 support (IDNA 2008). This is e.g. allowing
|
|
|
b07f02 |
the 'ß' character in domain names. See also the Red Hat Bugzilla #1098789 for some further
|
|
|
b07f02 |
information: https://bugzilla.redhat.com/show_bug.cgi?id=1098789
|
|
|
b07f02 |
|
|
|
b07f02 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
b07f02 |
---
|
|
|
b07f02 |
Makefile.config.in | 2 +-
|
|
|
b07f02 |
configure.in | 4 ++--
|
|
|
b07f02 |
src/osdep/win32/win32.c | 2 +-
|
|
|
b07f02 |
src/protocol/uri.c | 18 +++++++-----------
|
|
|
b07f02 |
4 files changed, 11 insertions(+), 15 deletions(-)
|
|
|
b07f02 |
|
|
|
b07f02 |
diff --git a/Makefile.config.in b/Makefile.config.in
|
|
|
b07f02 |
index fe1a559..829d350 100644
|
|
|
b07f02 |
--- a/Makefile.config.in
|
|
|
b07f02 |
+++ b/Makefile.config.in
|
|
|
b07f02 |
@@ -130,7 +130,7 @@ CONFIG_GOPHER = @CONFIG_GOPHER@
|
|
|
b07f02 |
CONFIG_GPM = @CONFIG_GPM@
|
|
|
b07f02 |
CONFIG_GZIP = @CONFIG_GZIP@
|
|
|
b07f02 |
CONFIG_HTML_HIGHLIGHT = @CONFIG_HTML_HIGHLIGHT@
|
|
|
b07f02 |
-CONFIG_IDN = @CONFIG_IDN@
|
|
|
b07f02 |
+CONFIG_IDN2 = @CONFIG_IDN2@
|
|
|
b07f02 |
CONFIG_INTERLINK = @CONFIG_INTERLINK@
|
|
|
b07f02 |
CONFIG_IPV6 = @CONFIG_IPV6@
|
|
|
b07f02 |
CONFIG_JW = @CONFIG_JW@
|
|
|
b07f02 |
diff --git a/configure.in b/configure.in
|
|
|
b07f02 |
index 3ef8603..3f74d9c 100644
|
|
|
b07f02 |
--- a/configure.in
|
|
|
b07f02 |
+++ b/configure.in
|
|
|
b07f02 |
@@ -473,8 +473,8 @@ EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
|
|
|
b07f02 |
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
|
|
|
b07f02 |
[ --without-bzlib disable bzlib support])
|
|
|
b07f02 |
|
|
|
b07f02 |
-EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
|
|
|
b07f02 |
- [ --without-idn disable international domain names support])
|
|
|
b07f02 |
+EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN2, idn2, idn2.h, idn2, idn2_lookup_ul,
|
|
|
b07f02 |
+ [ --without-idn2 disable international domain names support])
|
|
|
b07f02 |
|
|
|
b07f02 |
if test "x${with_gc}" != xno; then
|
|
|
b07f02 |
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
|
|
|
b07f02 |
diff --git a/src/osdep/win32/win32.c b/src/osdep/win32/win32.c
|
|
|
b07f02 |
index 66b2128..e870a6e 100644
|
|
|
b07f02 |
--- a/src/osdep/win32/win32.c
|
|
|
b07f02 |
+++ b/src/osdep/win32/win32.c
|
|
|
b07f02 |
@@ -48,7 +48,7 @@ init_osdep(void)
|
|
|
b07f02 |
#ifdef HAVE_LOCALE_H
|
|
|
b07f02 |
setlocale(LC_ALL, "");
|
|
|
b07f02 |
#endif
|
|
|
b07f02 |
-#ifdef CONFIG_IDN
|
|
|
b07f02 |
+#ifdef CONFIG_IDN2
|
|
|
b07f02 |
{
|
|
|
b07f02 |
char buf[60];
|
|
|
b07f02 |
UINT cp = GetACP();
|
|
|
b07f02 |
diff --git a/src/protocol/uri.c b/src/protocol/uri.c
|
|
|
b07f02 |
index 5e23ea2..8987567 100644
|
|
|
b07f02 |
--- a/src/protocol/uri.c
|
|
|
b07f02 |
+++ b/src/protocol/uri.c
|
|
|
b07f02 |
@@ -6,8 +6,8 @@
|
|
|
b07f02 |
|
|
|
b07f02 |
#include <ctype.h>
|
|
|
b07f02 |
#include <errno.h>
|
|
|
b07f02 |
-#ifdef HAVE_IDNA_H
|
|
|
b07f02 |
-#include <idna.h>
|
|
|
b07f02 |
+#ifdef HAVE_IDN2_H
|
|
|
b07f02 |
+#include <idn2.h>
|
|
|
b07f02 |
#endif
|
|
|
b07f02 |
#include <stdio.h>
|
|
|
b07f02 |
#include <stdlib.h>
|
|
|
b07f02 |
@@ -531,24 +531,20 @@ add_uri_to_string(struct string *string, const struct uri *uri,
|
|
|
b07f02 |
* --pasky */
|
|
|
b07f02 |
if (uri->ipv6 && wants(URI_PORT)) add_char_to_string(string, '[');
|
|
|
b07f02 |
#endif
|
|
|
b07f02 |
-#ifdef CONFIG_IDN
|
|
|
b07f02 |
+#ifdef CONFIG_IDN2
|
|
|
b07f02 |
/* Support for the GNU International Domain Name library.
|
|
|
b07f02 |
*
|
|
|
b07f02 |
- * http://www.gnu.org/software/libidn/manual/html_node/IDNA-Functions.html
|
|
|
b07f02 |
- *
|
|
|
b07f02 |
- * Now it is probably not perfect because idna_to_ascii_lz()
|
|
|
b07f02 |
- * will be using a ``zero terminated input string encoded in
|
|
|
b07f02 |
- * the current locale's character set''. Anyway I don't know
|
|
|
b07f02 |
- * how to convert anything to UTF-8 or Unicode. --jonas */
|
|
|
b07f02 |
+ * http://www.gnu.org/software/libidn/libidn2/manual/libidn2.html
|
|
|
b07f02 |
+ */
|
|
|
b07f02 |
if (wants(URI_IDN)) {
|
|
|
b07f02 |
unsigned char *host = memacpy(uri->host, uri->hostlen);
|
|
|
b07f02 |
|
|
|
b07f02 |
if (host) {
|
|
|
b07f02 |
char *idname;
|
|
|
b07f02 |
- int code = idna_to_ascii_lz(host, &idname, 0);
|
|
|
b07f02 |
+ int code = idn2_lookup_ul(host, &idname, 0);
|
|
|
b07f02 |
|
|
|
b07f02 |
/* FIXME: Return NULL if it coughed? --jonas */
|
|
|
b07f02 |
- if (code == IDNA_SUCCESS) {
|
|
|
b07f02 |
+ if (code == IDN2_OK) {
|
|
|
b07f02 |
add_to_string(string, idname);
|
|
|
b07f02 |
free(idname);
|
|
|
b07f02 |
add_host = 0;
|
|
|
b07f02 |
--
|
|
|
b07f02 |
1.9.3
|
|
|
b07f02 |
|