Skip to content

Commit cc22f0d

Browse files
author
Darshit Shah
committed
Remove support for libunistring and libidn2 < 0.14
* configure.ac: Remove support for libidn2 < 0.14 and libunistring * libwget/encoding.c: Same * README.md: Same
1 parent 214f242 commit cc22f0d

File tree

4 files changed

+9
-59
lines changed

4 files changed

+9
-59
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ See the end for copying conditions.
66

77
Please send GNU Wget2 bug reports to <[email protected]>.
88

9+
XX.XX.XXXX Release 1.99.2
10+
* Remove support for libidn2 < 0.14 and libunistring
11+
912
30.05.2018 Release 1.99.1 (alpha)
1013
* Enhance docs
1114
* Enhance building on many platforms

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ The following packages are needed to build the software
114114
* libbz2 >= 1.0.6 (optional, if you want HTTP bzip2 decompression)
115115
* libbrotlidec >= 1.0.0 (optional, if you want HTTP brotli decompression)
116116
* libgnutls (3.3, 3.5 or 3.6)
117-
* libidn2 >= 0.9 + libunistring >= 0.9.3 (libidn >= 1.25 if you don't have libidn2)
117+
* libidn2 >= 0.14 (libidn >= 1.25 if you don't have libidn2)
118118
* flex >= 2.5.35
119119
* libpsl >= 0.5.0
120120
* libnghttp2 >= 1.3.0 (optional, if you want HTTP/2 support)

configure.ac

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -581,36 +581,23 @@ AM_CONDITIONAL([WITH_BROTLIDEC], [test "x$with_brotlidec" = xyes])
581581
# Support for internationalized domain names.
582582
# IDN support in Wget2 is provided in multiple ways:
583583
# 1. libidn2 >= 0.14.0 (IDNA 2008)
584-
# 2. libidn2 < 0.14.0 + libunistring (IDNA 2008)
585584
# 3. libidn (IDNA 2003)
586585
#
587-
# Versions of libidn2 prior to 0.14.0 did not provide a pkg-config file. Hence,
588-
# if detection of libidn2 with pkg-config fails, we assume that either
589-
# libidn2 is not available or it is an older version. Older versions of libidn2
590-
# also require libunistring to support IDN2008 on uppercase domain names.
591-
#
592586
# If libidn2 is not found at all, we try to fallback to libidn.
593587
AC_ARG_WITH(libidn2, AS_HELP_STRING([--without-libidn2], [disable IDN2 support]), with_libidn2=$withval, with_libidn2=yes)
594588
AS_IF([test "x$with_libidn2" != xno], [
595-
PKG_CHECK_MODULES([LIBIDN2], libidn2, [
589+
PKG_CHECK_MODULES([LIBIDN2], [libidn2 >= 0.14.0], [
596590
with_libidn2=yes
597-
IDNA_INFO="IDNA 2008 (libidn2)"
591+
IDNA_INFO="IDNA 2008 (libidn2)"
598592
LIBS="$LIBIDN2_LIBS $LIBS"
599593
CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
600594
AC_DEFINE([WITH_LIBIDN2], [1], [Use libidn2])
601595
], [
602-
AC_SEARCH_LIBS(idn2_lookup_u8, idn2,
603-
[with_libidn2=yes; AC_DEFINE([WITH_LIBIDN2], [1], [Use libidn2]) IDNA_INFO="IDNA 2008 (libidn2)"],
604-
[with_libidn2=no; AC_MSG_WARN(*** LIBIDN2 was not found. You will not be able to use IDN2008 support)],
605-
-lunistring)
606-
AS_IF([test "x$with_libidn2" = xyes], [
607-
AC_SEARCH_LIBS(u8_tolower, unistring,
608-
[with_libunistring=yes; AC_DEFINE([WITH_LIBUNISTRING], [1], [Use libunistring]) IDNA_INFO="IDNA 2008 (libidn2+libunistring)"],
609-
[with_libunistring=no; AC_MSG_WARN(*** LIBUNISTRING was not found. You will not be able to use IDN2008 on uppercase domains)])
596+
with_libidn2=no
597+
AC_MSG_WARN(*** LIBIDN2 was not found. You will not be able to use IDN2008 support)
610598
])
611-
])
612599
])
613-
AM_CONDITIONAL([WITH_LIBUNISTRING], [test "x$with_libunistring" = xyes])
600+
614601
AM_CONDITIONAL([WITH_LIBIDN2], [test "x$with_libidn2" = xyes])
615602

616603
AS_IF([test "x$with_libidn2" != xyes], [

libwget/encoding.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838

3939
#if defined HAVE_IDN2_H && defined WITH_LIBIDN2
4040
# include <idn2.h>
41-
# if IDN2_VERSION_NUMBER < 0x00140000
42-
# if defined HAVE_UNICASE_H && defined WITH_LIBUNISTRING
43-
# include <unicase.h>
44-
# include <unistr.h>
45-
# endif
46-
# endif
4741
#elif defined HAVE_IDNA_H && defined WITH_LIBIDN
4842
# include <idna.h>
4943
# ifdef _WIN32
@@ -234,42 +228,9 @@ const char *wget_str_to_ascii(const char *src)
234228
if (wget_str_needs_encoding(src)) {
235229
char *asc = NULL;
236230
int rc;
237-
# if defined WITH_LIBUNISTRING && IDN2_VERSION_NUMBER < 0x00140000
238-
uint8_t *lower, resbuf[256];
239-
size_t len = sizeof(resbuf) - 1; // leave space for additional \0 byte
240-
241-
// we need a conversion to lowercase
242-
lower = u8_tolower((uint8_t *)src, u8_strlen((uint8_t *)src), 0, UNINORM_NFKC, resbuf, &len);
243-
if (!lower) {
244-
error_printf(_("u8_tolower(%s) failed (%d)\n"), src, errno);
245-
return src;
246-
}
247-
248-
// u8_tolower() does not terminate the result string
249-
if (lower == resbuf) {
250-
lower[len]=0;
251-
} else {
252-
uint8_t *tmp = lower;
253-
lower = (uint8_t *)wget_strmemdup((char *)lower, len);
254-
xfree(tmp);
255-
}
256-
257-
if ((rc = idn2_lookup_u8(lower, (uint8_t **)&asc, 0)) == IDN2_OK) {
258-
debug_printf("idn2 '%s' -> '%s'\n", src, asc);
259-
src = asc;
260-
} else
261-
error_printf(_("toASCII(%s) failed (%d): %s\n"), lower, rc, idn2_strerror(rc));
262-
263-
if (lower != resbuf)
264-
xfree(lower);
265-
# else
266-
# if IDN2_VERSION_NUMBER < 0x00140000
267-
if ((rc = idn2_lookup_u8((uint8_t *)src, (uint8_t **)&asc, 0)) == IDN2_OK)
268-
# else
269231
if ((rc = idn2_lookup_u8((uint8_t *)src, (uint8_t **)&asc, IDN2_NONTRANSITIONAL)) != IDN2_OK)
270232
rc = idn2_lookup_u8((uint8_t *)src, (uint8_t **)&asc, IDN2_TRANSITIONAL);
271233
if (rc == IDN2_OK)
272-
# endif
273234
{
274235
debug_printf("idn2 '%s' -> '%s'\n", src, asc);
275236
# ifdef _WIN32
@@ -280,7 +241,6 @@ const char *wget_str_to_ascii(const char *src)
280241
# endif
281242
} else
282243
error_printf(_("toASCII(%s) failed (%d): %s\n"), src, rc, idn2_strerror(rc));
283-
# endif
284244
}
285245
#elif defined WITH_LIBIDN
286246
if (wget_str_needs_encoding(src)) {

0 commit comments

Comments
 (0)