2022-04-11 07:52:42 +00:00
|
|
|
From f6735d03337aedecfad13a72c1b98eae16c89e29 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Kamil Dudka <kdudka@redhat.com>
|
|
|
|
Date: Mon, 11 Apr 2022 09:39:48 +0200
|
|
|
|
Subject: [PATCH] Resolves: #1098789 - add support for GNU Libidn2
|
2014-05-30 13:40:18 +00:00
|
|
|
|
2022-04-11 07:52:42 +00:00
|
|
|
patch by Robert Scheck
|
2014-05-30 13:40:18 +00:00
|
|
|
---
|
|
|
|
Makefile.config.in | 2 +-
|
2022-04-11 07:52:42 +00:00
|
|
|
configure.ac | 4 ++--
|
2014-05-30 13:40:18 +00:00
|
|
|
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
|
2022-04-11 07:52:42 +00:00
|
|
|
index f68c8fc..5a69fb0 100644
|
2014-05-30 13:40:18 +00:00
|
|
|
--- a/Makefile.config.in
|
|
|
|
+++ b/Makefile.config.in
|
2022-04-11 07:52:42 +00:00
|
|
|
@@ -136,7 +136,7 @@ CONFIG_GOPHER = @CONFIG_GOPHER@
|
2014-05-30 13:40:18 +00:00
|
|
|
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@
|
2022-04-11 07:52:42 +00:00
|
|
|
CONFIG_DBLATEX = @CONFIG_DBLATEX@
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
|
|
index 6c811ae..34b3706 100644
|
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
|
|
|
@@ -548,8 +548,8 @@ EL_LOG_CONFIG([CONFIG_BROTLI], [[brotli]], [[$enable_brotli]])
|
|
|
|
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
|
|
|
|
[ --with-lzma enable lzma encoding support])
|
2014-05-30 13:40:18 +00:00
|
|
|
|
|
|
|
-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,
|
2022-04-11 07:52:42 +00:00
|
|
|
+ [ --without-idn2 disable international domain names support])
|
2014-05-30 13:40:18 +00:00
|
|
|
|
2022-04-11 07:52:42 +00:00
|
|
|
# ===================================================================
|
|
|
|
# Check for GSSAPI, optional even if installed.
|
2014-05-30 13:40:18 +00:00
|
|
|
diff --git a/src/osdep/win32/win32.c b/src/osdep/win32/win32.c
|
2022-04-11 07:52:42 +00:00
|
|
|
index 02b1834..f4c148d 100644
|
2014-05-30 13:40:18 +00:00
|
|
|
--- a/src/osdep/win32/win32.c
|
|
|
|
+++ b/src/osdep/win32/win32.c
|
2022-04-11 07:52:42 +00:00
|
|
|
@@ -44,7 +44,7 @@ init_osdep(void)
|
|
|
|
}
|
2014-05-30 13:40:18 +00:00
|
|
|
#endif
|
2022-04-11 07:52:42 +00:00
|
|
|
setlocale(LC_ALL, "");
|
2014-05-30 13:40:18 +00:00
|
|
|
-#ifdef CONFIG_IDN
|
|
|
|
+#ifdef CONFIG_IDN2
|
|
|
|
{
|
|
|
|
char buf[60];
|
|
|
|
UINT cp = GetACP();
|
|
|
|
diff --git a/src/protocol/uri.c b/src/protocol/uri.c
|
2022-04-11 07:52:42 +00:00
|
|
|
index 8c4fd76..05ef50f 100644
|
2014-05-30 13:40:18 +00:00
|
|
|
--- 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)) {
|
2022-04-11 07:52:42 +00:00
|
|
|
char *host = memacpy(uri->host, uri->hostlen);
|
2014-05-30 13:40:18 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
--
|
2022-04-11 07:52:42 +00:00
|
|
|
2.34.1
|
2014-05-30 13:40:18 +00:00
|
|
|
|