#elif defined(USE_WIN32_IDN)
/* prototype for curl_win32_idn_to_ascii() */
bool curl_win32_idn_to_ascii(const char *in, char **out);
+#elif defined(USE_ICU_IDNA)
+#include <unicode/uidna.h>
#endif /* USE_LIBIDN2 */
#include "urldata.h"
#include "curl_memory.h"
#include "memdebug.h"
+#if defined(USE_ICU_IDNA)
+#define MAX_DOMAIN_NAME_LEN 256
+#endif /* USE_ICU_IDNA */
+
static void conn_free(struct connectdata *conn);
static void free_fixed_hostname(struct hostname *host);
static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke);
else {
failf(data, "Failed to convert %s to ACE;\n", host->name);
return CURLE_URL_MALFORMAT;
+#elif defined(USE_ICU_IDNA)
+ char *ace_hostname = malloc(MAX_DOMAIN_NAME_LEN * sizeof(char));
+ UErrorCode errorCode = U_ZERO_ERROR;
+ UIDNAInfo info = UIDNA_INFO_INITIALIZER;
+ UIDNA *uts46 =
+ uidna_openUTS46(UIDNA_USE_STD3_RULES|UIDNA_NONTRANSITIONAL_TO_UNICODE,
+ &errorCode);
+ int32_t length = uidna_nameToASCII_UTF8(uts46,
+ host->name, strlen(host->name),
+ ace_hostname, MAX_DOMAIN_NAME_LEN, &info, &errorCode);
+ uidna_close(uts46);
+
+ if(errorCode != U_ZERO_ERROR || info.errors || length < 1)
+ infof(data, "Failed to convert %s to ACE;\n", host->name);
+ else {
+ host->encalloc = ace_hostname;
+ host->name = host->encalloc;
}
#else
infof(data, "IDN support not present, can't parse Unicode domains\n");
free(host->encalloc); /* must be freed with free() since this was
allocated by curl_win32_idn_to_ascii */
host->encalloc = NULL;
+#elif defined(USE_ICU_IDNA)
+ free(host->encalloc);
+ host->encalloc = NULL;
#else
(void)host;
#endif
Source0: %{name}-%{version}.tar.gz
Source1001: %{name}.manifest
+BuildRequires: pkgconfig(icu-uc)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(libcares)
%endif
--with-ca-path==/etc/ssl/certs \
--with-ca-bundle=/etc/ssl/ca-bundle.pem \
+--with-icu-uc \
--with-lber-lib=lber \
--enable-manual --enable-versioned-symbols --enable-ares --enable-debug --enable-curldebug \
--disable-static \