cURL-build-win32/patch/old/curl_url.diff

36 lines
1.4 KiB
Diff
Raw Normal View History

2021-06-13 17:14:29 +02:00
diff --git "a/D:\\_Sandbox\\curl\\curl-x86\\lib\\url.c.orig" "b/D:\\_Sandbox\\curl\\curl-x86\\lib\\url.c"
index 1ee38af..99c7740 100644
--- "a/lib/url.c"
+++ "b/lib/url.c"
2021-06-13 15:54:07 +02:00
@@ -62,6 +62,14 @@
#ifdef USE_LIBIDN2
#include <idn2.h>
+#if defined(WIN32) && defined(UNICODE)
+#define IDN2_LOOKUP(name, host, flags) \
+ idn2_lookup_u8((const uint8_t *)name, (uint8_t **)host, flags)
+#else
+#define IDN2_LOOKUP(name, host, flags) \
+ idn2_lookup_ul((const char *)name, (char **)host, flags)
+#endif
+
#elif defined(USE_WIN32_IDN)
/* prototype for curl_win32_idn_to_ascii() */
bool curl_win32_idn_to_ascii(const char *in, char **out);
2021-06-13 17:14:29 +02:00
@@ -1577,12 +1585,12 @@ CURLcode Curl_idnconvert_hostname(struct Curl_easy *data,
2021-06-10 02:15:19 +02:00
#else
int flags = IDN2_NFC_INPUT;
#endif
- int rc = idn2_lookup_ul((const char *)host->name, &ace_hostname, flags);
2021-06-13 15:54:07 +02:00
+ int rc = IDN2_LOOKUP(host->name, &ace_hostname, flags);
2021-06-10 02:15:19 +02:00
if(rc != IDN2_OK)
/* fallback to TR46 Transitional mode for better IDNA2003
compatibility */
- rc = idn2_lookup_ul((const char *)host->name, &ace_hostname,
2021-06-13 15:54:07 +02:00
- IDN2_TRANSITIONAL);
+ rc = IDN2_LOOKUP(host->name, &ace_hostname,
+ IDN2_TRANSITIONAL);
2021-06-10 02:15:19 +02:00
if(rc == IDN2_OK) {
host->encalloc = (char *)ace_hostname;
2021-06-13 15:54:07 +02:00
/* change the name pointer to point to the encoded hostname */