cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: IDN support using native win32 APIs

From: Guenter <lists_at_gknw.net>
Date: Tue, 19 Apr 2011 20:56:17 +0200

Hi Pierre,
Am 28.12.2010 12:25, schrieb Pierre Joye:
> I updated the patch:
>
> - fix the build (wrong #ifdef to free the hostnames)
> - add version and features info for Win32's IDN support
sometimes things take a bit longer ... :-)
but finally I got around to check a bit with your Win32 native IDN
support + MinGW ...
1st I found that there exists a idndlpackage which can separately
downloaded from MSDN and adds IDN support to WXP SP2 / W2K3 SP1:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815
this comes also with a header normalization.h which provides the
prototypes for IdnToAscii / IdnToUnicode, and since MinGW can directly
link against normaliz.dll I was then able to build with Win32 native IDN ...

then I found few other things which I've now fixed in git:

in ./lib/idn_win32.c:
- changed windows.h include to system header;
- changed obsolete 2nd check for str_w to str_utf8 in order to catch
   malloc() failure and avoid a free(NULL);
- changed calls to GetLastError() to void to kill unsused var compiler
   warnings;
- moved one call to GetLastError() into else case so that its only
   called when WideCharToMultiByte() really fails.

https://github.com/bagder/curl/commit/519bec7c916d2062249838d42a20ed7fb6ed9119

in ./lib/url.c:
- provided prototype for curl_win32_idn_to_ascii();
- removed wrong 3rd parameter from curl_win32_idn_to_ascii() call.

https://github.com/bagder/curl/commit/24e5a40156b0dda012d3ff940a49d9fef4524bdc

finally some comments:
the 'win32' in both the define (USE_WIN32_IDN) and the filename
(idn_win32.c) sound a bit if it would only work with 32-bit Windows;
f.e. for SSPI support we define USE_WINDOWS_SSPI, so we should probably
change the define for native IDN to USE_WINDOWS_IDN ... ?
and probably also rename idn_win32.c -> idn_windows.c ?
I have no strong oppinion on this, its more just s suggestion ...

Oh, and do you know some public accessable addresses which can be used
for testing?

greets, Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-19