Changelog
Daniel (24 May 2004)
+- Simon Josefsson added a idn_free() function in libidn 0.4.5 as a reaction to
+ Gisle's previous mail. We now use this function, and thus we require libidn
+ 0.4.5 or later. No earler version will do.
+
- Robert D. Young reported that CURLOPT_COOKIEFILE and CURLOPT_COOKIE could
not be used both in one request. Fixed it and added test case 172 to verify.
#ifdef USE_LIBIDN
#include <idna.h>
#include <stringprep.h>
+void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
+ libidn 0.4.5's make install! */
#endif
#ifdef HAVE_OPENSSL_ENGINE_H
Curl_safefree(conn->host.rawalloc); /* host name buffer */
Curl_safefree(conn->proxy.rawalloc); /* proxy name buffer */
if(conn->host.encalloc)
- (free)(conn->host.encalloc); /* encoded host name buffer, must be freed
- with free() since this was allocated by
- libidn */
+ idn_free(conn->host.encalloc); /* encoded host name buffer, must be freed
+ with idn_free() since this was allocated
+ by libidn */
if(conn->proxy.encalloc)
- (free)(conn->proxy.encalloc); /* encoded proxy name buffer, must be freed
- with free() since this was allocated by
- libidn */
+ idn_free(conn->proxy.encalloc); /* encoded proxy name buffer, must be
+ freed with idn_free() since this was
+ allocated by libidn */
Curl_SSL_Close(conn);
/* close possibly still open sockets */
/*************************************************************
* Check name for non-ASCII and convert hostname to ACE form.
*************************************************************/
- if (!is_ASCII_name(host->name)) {
+ if (!is_ASCII_name(host->name) &&
+ stringprep_check_version(LIBIDN_REQUIRED_VERSION)) {
char *ace_hostname = NULL;
struct SessionHandle *data = conn->data;
int rc = idna_to_ascii_lz(host->name, &ace_hostname, 0);
ptr += strlen(ptr);
#endif
#ifdef USE_LIBIDN
- sprintf(ptr, " libidn/%s", stringprep_check_version(NULL));
- ptr += strlen(ptr);
+ if(stringprep_check_version(LIBIDN_REQUIRED_VERSION)) {
+ sprintf(ptr, " libidn/%s", stringprep_check_version(NULL));
+ ptr += strlen(ptr);
+ }
#endif
return version;
#if defined(ENABLE_64BIT) && (SIZEOF_CURL_OFF_T > 4)
| CURL_VERSION_LARGEFILE
#endif
-#ifdef USE_LIBIDN
- | CURL_VERSION_IDN
-#endif
,
NULL, /* ssl_version */
0, /* ssl_version_num */
version_info.ares_num = aresnum;
}
#endif
+#ifdef USE_LIBIDN
+ /* This returns a version string if we use the given version or later,
+ otherwise it returns NULL */
+ version_info.libidn = stringprep_check_version(LIBIDN_REQUIRED_VERSION);
+ if(version_info.libidn)
+ version_info.features |= CURL_VERSION_IDN;
+#endif
(void)stamp; /* avoid compiler warnings, we don't use this */
return &version_info;