[elinks] add support for GNU Libidn2, patch by Robert Scheck (#1098789)

Kamil Dudka kdudka at fedoraproject.org
Fri May 30 13:49:14 UTC 2014


commit 8636c2c7aa2962d90eac50cbbda4c98e04b8ea6a
Author: Kamil Dudka <kdudka at redhat.com>
Date:   Fri May 30 15:40:18 2014 +0200

    add support for GNU Libidn2, patch by Robert Scheck (#1098789)

 elinks-0.12pre6-libidn2.patch |  110 +++++++++++++++++++++++++++++++++++++++++
 elinks.spec                   |   11 +++-
 2 files changed, 119 insertions(+), 2 deletions(-)
---
diff --git a/elinks-0.12pre6-libidn2.patch b/elinks-0.12pre6-libidn2.patch
new file mode 100644
index 0000000..c4bd862
--- /dev/null
+++ b/elinks-0.12pre6-libidn2.patch
@@ -0,0 +1,110 @@
+From 496afe1f27481eb45ac14df0bfdb287b95eefbdd Mon Sep 17 00:00:00 2001
+From: Robert Scheck <redhat-bugzilla at linuxnetz.de>
+Date: Fri, 30 May 2014 15:28:54 +0200
+Subject: [PATCH] Add support for GNU Libidn2
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Patch by Robert Scheck <robert at fedoraproject.org> for elinks >= 0.12 which replaces current
+GNU Libidn support (IDNA 2003) by GNU Libidn2 support (IDNA 2008). This is e.g. allowing
+the 'ß' character in domain names. See also the Red Hat Bugzilla #1098789 for some further
+information: https://bugzilla.redhat.com/show_bug.cgi?id=1098789
+
+Signed-off-by: Kamil Dudka <kdudka at redhat.com>
+---
+ Makefile.config.in      |  2 +-
+ configure.in            |  4 ++--
+ src/osdep/win32/win32.c |  2 +-
+ src/protocol/uri.c      | 18 +++++++-----------
+ 4 files changed, 11 insertions(+), 15 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index fe1a559..829d350 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -129,7 +129,7 @@ CONFIG_GOPHER = @CONFIG_GOPHER@
+ CONFIG_GPM = @CONFIG_GPM@
+ CONFIG_GZIP = @CONFIG_GZIP@
+ CONFIG_HTML_HIGHLIGHT = @CONFIG_HTML_HIGHLIGHT@
+-CONFIG_IDN = @CONFIG_IDN@
++CONFIG_IDN2 = @CONFIG_IDN2@
+ CONFIG_INTERLINK = @CONFIG_INTERLINK@
+ CONFIG_IPV6 = @CONFIG_IPV6@
+ CONFIG_JW = @CONFIG_JW@
+diff --git a/configure.in b/configure.in
+index 3ef8603..3f74d9c 100644
+--- a/configure.in
++++ b/configure.in
+@@ -472,8 +472,8 @@ EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
+ EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
+ 	[  --without-bzlib         disable bzlib support])
+ 
+-EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
+-	[  --without-idn           disable international domain names support])
++EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN2, idn2, idn2.h, idn2, idn2_lookup_ul,
++	[  --without-idn2           disable international domain names support])
+ 
+ if test "x${with_gc}" != xno; then
+ 	EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
+diff --git a/src/osdep/win32/win32.c b/src/osdep/win32/win32.c
+index 66b2128..e870a6e 100644
+--- a/src/osdep/win32/win32.c
++++ b/src/osdep/win32/win32.c
+@@ -48,7 +48,7 @@ init_osdep(void)
+ #ifdef HAVE_LOCALE_H
+ 	setlocale(LC_ALL, "");
+ #endif
+-#ifdef CONFIG_IDN
++#ifdef CONFIG_IDN2
+ 	{
+ 		char buf[60];
+ 		UINT cp = GetACP();
+diff --git a/src/protocol/uri.c b/src/protocol/uri.c
+index 5e23ea2..8987567 100644
+--- a/src/protocol/uri.c
++++ b/src/protocol/uri.c
+@@ -6,8 +6,8 @@
+ 
+ #include <ctype.h>
+ #include <errno.h>
+-#ifdef HAVE_IDNA_H
+-#include <idna.h>
++#ifdef HAVE_IDN2_H
++#include <idn2.h>
+ #endif
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -531,24 +531,20 @@ add_uri_to_string(struct string *string, const struct uri *uri,
+ 		 * --pasky */
+ 		if (uri->ipv6 && wants(URI_PORT)) add_char_to_string(string, '[');
+ #endif
+-#ifdef CONFIG_IDN
++#ifdef CONFIG_IDN2
+ 		/* Support for the GNU International Domain Name library.
+ 		 *
+-		 * http://www.gnu.org/software/libidn/manual/html_node/IDNA-Functions.html
+-		 *
+-		 * Now it is probably not perfect because idna_to_ascii_lz()
+-		 * will be using a ``zero terminated input string encoded in
+-		 * the current locale's character set''. Anyway I don't know
+-		 * how to convert anything to UTF-8 or Unicode. --jonas */
++		 * http://www.gnu.org/software/libidn/libidn2/manual/libidn2.html
++		 */
+ 		if (wants(URI_IDN)) {
+ 			unsigned char *host = memacpy(uri->host, uri->hostlen);
+ 
+ 			if (host) {
+ 				char *idname;
+-				int code = idna_to_ascii_lz(host, &idname, 0);
++				int code = idn2_lookup_ul(host, &idname, 0);
+ 
+ 				/* FIXME: Return NULL if it coughed? --jonas */
+-				if (code == IDNA_SUCCESS) {
++				if (code == IDN2_OK) {
+ 					add_to_string(string, idname);
+ 					free(idname);
+ 					add_host = 0;
+-- 
+1.9.3
+
diff --git a/elinks.spec b/elinks.spec
index 964658c..e8b59fe 100644
--- a/elinks.spec
+++ b/elinks.spec
@@ -3,7 +3,7 @@
 Name:      elinks
 Summary:   A text-mode Web browser
 Version:   0.12
-Release:   0.39.%{prerel}%{?dist}
+Release:   0.40.%{prerel}%{?dist}
 License:   GPLv2
 URL:       http://elinks.or.cz
 Group:     Applications/Internet
@@ -16,7 +16,7 @@ BuildRequires: expat-devel
 BuildRequires: gpm-devel
 BuildRequires: js-devel
 BuildRequires: krb5-devel
-BuildRequires: libidn-devel
+BuildRequires: libidn2-devel
 BuildRequires: lua-devel
 BuildRequires: nss_compat_ossl-devel
 BuildRequires: pkgconfig
@@ -45,6 +45,7 @@ Patch13: elinks-0.12pre6-autoconf.patch
 Patch14: elinks-0.12pre6-ssl-hostname.patch
 Patch15: elinks-0.12pre6-list_is_singleton.patch
 Patch16: elinks-0.12pre6-lua51.patch
+Patch17: elinks-0.12pre6-libidn2.patch
 
 %description
 Elinks is a text-based Web browser. Elinks does not display any images,
@@ -100,6 +101,9 @@ quickly and swiftly displays Web pages.
 # use later versions of lua since lua50 is not available (#1098392)
 %patch16 -p1
 
+# add support for GNU Libidn2, patch by Robert Scheck (#1098789)
+%patch17 -p1
+
 # remove bogus serial numbers
 sed -i 's/^# *serial [AM0-9]*$//' acinclude.m4 config/m4/*.m4
 
@@ -168,6 +172,9 @@ exit 0
 %{_mandir}/man5/*
 
 %changelog
+* Fri May 30 2014 Kamil Dudka <kdudka at redhat.com> - 0.12-0.40.pre6
+- add support for GNU Libidn2, patch by Robert Scheck (#1098789)
+
 * Wed May 21 2014 Kamil Dudka <kdudka at redhat.com> - 0.12-0.39.pre6
 - use later versions of lua since lua50 is not available (#1098392)
 


More information about the scm-commits mailing list