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.
This commit is contained in:
Daniel Stenberg 2004-05-24 07:40:00 +00:00
parent 59f904d8de
commit 24420c2191
4 changed files with 26 additions and 12 deletions

View File

@ -7,6 +7,10 @@
Changelog Changelog
Daniel (24 May 2004) 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 - 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. not be used both in one request. Fixed it and added test case 172 to verify.

View File

@ -304,6 +304,7 @@ typedef struct in_addr Curl_ipconnect;
/* This could benefit from additional checks that some of the used/important /* This could benefit from additional checks that some of the used/important
header files are present as well before we define the USE_* define. */ header files are present as well before we define the USE_* define. */
#define USE_LIBIDN #define USE_LIBIDN
#define LIBIDN_REQUIRED_VERSION "0.4.5"
#endif #endif
#endif /* __CONFIG_H */ #endif /* __CONFIG_H */

View File

@ -87,6 +87,8 @@
#ifdef USE_LIBIDN #ifdef USE_LIBIDN
#include <idna.h> #include <idna.h>
#include <stringprep.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 #endif
#ifdef HAVE_OPENSSL_ENGINE_H #ifdef HAVE_OPENSSL_ENGINE_H
@ -1390,13 +1392,13 @@ CURLcode Curl_disconnect(struct connectdata *conn)
Curl_safefree(conn->host.rawalloc); /* host name buffer */ Curl_safefree(conn->host.rawalloc); /* host name buffer */
Curl_safefree(conn->proxy.rawalloc); /* proxy name buffer */ Curl_safefree(conn->proxy.rawalloc); /* proxy name buffer */
if(conn->host.encalloc) if(conn->host.encalloc)
(free)(conn->host.encalloc); /* encoded host name buffer, must be freed idn_free(conn->host.encalloc); /* encoded host name buffer, must be freed
with free() since this was allocated by with idn_free() since this was allocated
libidn */ by libidn */
if(conn->proxy.encalloc) if(conn->proxy.encalloc)
(free)(conn->proxy.encalloc); /* encoded proxy name buffer, must be freed idn_free(conn->proxy.encalloc); /* encoded proxy name buffer, must be
with free() since this was allocated by freed with idn_free() since this was
libidn */ allocated by libidn */
Curl_SSL_Close(conn); Curl_SSL_Close(conn);
/* close possibly still open sockets */ /* close possibly still open sockets */
@ -1997,7 +1999,8 @@ static void fix_hostname(struct connectdata *conn, struct hostname *host)
/************************************************************* /*************************************************************
* Check name for non-ASCII and convert hostname to ACE form. * 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; char *ace_hostname = NULL;
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
int rc = idna_to_ascii_lz(host->name, &ace_hostname, 0); int rc = idna_to_ascii_lz(host->name, &ace_hostname, 0);

View File

@ -132,8 +132,10 @@ char *curl_version(void)
ptr += strlen(ptr); ptr += strlen(ptr);
#endif #endif
#ifdef USE_LIBIDN #ifdef USE_LIBIDN
sprintf(ptr, " libidn/%s", stringprep_check_version(NULL)); if(stringprep_check_version(LIBIDN_REQUIRED_VERSION)) {
ptr += strlen(ptr); sprintf(ptr, " libidn/%s", stringprep_check_version(NULL));
ptr += strlen(ptr);
}
#endif #endif
return version; return version;
@ -208,9 +210,6 @@ static curl_version_info_data version_info = {
#endif #endif
#if defined(ENABLE_64BIT) && (SIZEOF_CURL_OFF_T > 4) #if defined(ENABLE_64BIT) && (SIZEOF_CURL_OFF_T > 4)
| CURL_VERSION_LARGEFILE | CURL_VERSION_LARGEFILE
#endif
#ifdef USE_LIBIDN
| CURL_VERSION_IDN
#endif #endif
, ,
NULL, /* ssl_version */ NULL, /* ssl_version */
@ -244,6 +243,13 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
version_info.ares = ares_version(&aresnum); version_info.ares = ares_version(&aresnum);
version_info.ares_num = aresnum; 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 #endif
(void)stamp; /* avoid compiler warnings, we don't use this */ (void)stamp; /* avoid compiler warnings, we don't use this */