From 549ba9687716fc47596ae0176b74d9e553f588df Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Mon, 2 Jan 2023 09:23:59 +0100 Subject: [PATCH] Resolves: #1098789 - make the IDN2 support work again The patch was lost while rebasing to elinks-0.15.1 because it had not been upstreamed. --- 0006-elinks-0.16.0-libidn2.patch | 98 ++++++++++++++++++++++++++++++++ elinks.spec | 4 ++ 2 files changed, 102 insertions(+) create mode 100644 0006-elinks-0.16.0-libidn2.patch diff --git a/0006-elinks-0.16.0-libidn2.patch b/0006-elinks-0.16.0-libidn2.patch new file mode 100644 index 0000000..22bac40 --- /dev/null +++ b/0006-elinks-0.16.0-libidn2.patch @@ -0,0 +1,98 @@ +From 41461147907ed9a93792309f074072e981b33f42 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Mon, 11 Apr 2022 09:39:48 +0200 +Subject: [PATCH] Resolves: #1098789 - add support for GNU Libidn2 + +patch by Robert Scheck +--- + Makefile.config.in | 2 +- + configure.ac | 4 ++-- + src/osdep/win32/win32.c | 2 +- + src/protocol/uri.c | 12 ++++++------ + 4 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index bf01d78..73d9762 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -139,7 +139,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_DBLATEX = @CONFIG_DBLATEX@ +diff --git a/configure.ac b/configure.ac +index d4537ab..d3bf724 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -556,8 +556,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]) + +-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]) + + # =================================================================== + # Check for GSSAPI, optional even if installed. +diff --git a/src/osdep/win32/win32.c b/src/osdep/win32/win32.c +index 02b1834..f4c148d 100644 +--- a/src/osdep/win32/win32.c ++++ b/src/osdep/win32/win32.c +@@ -44,7 +44,7 @@ init_osdep(void) + } + #endif + setlocale(LC_ALL, ""); +-#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 a8f15d1..218d1af 100644 +--- a/src/protocol/uri.c ++++ b/src/protocol/uri.c +@@ -9,8 +9,8 @@ + #ifdef HAVE_ICONV + #include + #endif +-#ifdef HAVE_IDNA_H +-#include ++#ifdef HAVE_IDN2_H ++#include + #endif + #include + #include +@@ -535,10 +535,10 @@ 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 ++ * http://www.gnu.org/software/libidn/libidn2/manual/libidn2.html + */ + if (wants(URI_IDN)) { + char *host = NULL; +@@ -556,10 +556,10 @@ add_uri_to_string(struct string *string, const struct uri *uri, + + if (host) { + char *idname; +- int code = idna_to_ascii_8z(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; +-- +2.38.1 + diff --git a/elinks.spec b/elinks.spec index 32510f7..aa3bd43 100644 --- a/elinks.spec +++ b/elinks.spec @@ -44,6 +44,9 @@ Patch4: 0004-elinks-0.15.0-sysname.patch # Fix xterm terminal: "Linux" driver seems better than "VT100" (#128105) Patch5: 0005-elinks-0.15.0-xterm.patch +# add support for GNU Libidn2, patch by Robert Scheck (#1098789) +Patch6: 0006-elinks-0.16.0-libidn2.patch + # let list_is_singleton() return false for an empty list (#1075415) Patch15: elinks-0.12pre6-list_is_singleton.patch @@ -127,6 +130,7 @@ exit 0 %changelog * Mon Jan 02 2023 Kamil Dudka - 0.16.0-1 +- make the IDN2 support work again (#1098789) - new upstream release * Mon Aug 01 2022 Kamil Dudka - 0.15.1-1