2

I'm using libcurl in my windows application support Windows xp or higher, it is a single dll file, in order to make it easer to distribute to others, I removed every dependency file except the normaliz.dll. I know it is used for WinIDN, but it doesn't exist on Windows xp.

I'm wondering is there any way to remove normaliz.dll dependency? I can not use libidn because the license. I have researched for a long time and found the easiest way is compile the WinIDN source code in normaliz.dll with my project.

Accourding to https://github.com/curl/curl/blob/master/lib/idn_win32.c, I could see I need provide the IdnToAscii and IdnToUnicode function.

So the problem became to where could I see how normaliz.dll implement IdnToAscii and IdnToUnicode so that I could write the same functions by myself?

zzy
  • 1,771
  • 1
  • 13
  • 48
  • Essentially, you'd have to implement http://www.faqs.org/rfcs/rfc3490.html ("punycode" conversion); but I suspect that cURL already includes its own implementation for other platforms, so I'd start by searching in its codebase. An alternative could be to just disable the support for international domain names if you don't plan to use them; I don't know if there's any configure switch for that, in the worst case you could just change those functions to a no-op. – Matteo Italia Dec 21 '17 at 07:43
  • @MatteoItalia I think my code would need support idn in the feature, so it's better to implement it. I have researched the curl source code and seems it use libidn2 for other platforms, I'm not sure. – zzy Dec 21 '17 at 07:48
  • From a quick glance it seems that IDN are supported only on Win32 and only using normaliz.lib. Still, you can disable this support (and thus avoid depending from normaliz.dll) by not defining `USE_WIN32_IDN`. – Matteo Italia Dec 21 '17 at 07:48
  • @MatteoItalia I found the marco, thanks, but seems I need to learn how libidn2 implement it and write my own implementation. – zzy Dec 21 '17 at 07:50
  • Hmm you are right, there are some mentions about libidn2, but I don't see how it uses it. I'll probably be able to look better once I'm back on a regular PC. – Matteo Italia Dec 21 '17 at 07:51
  • @MatteoItalia Thanks a ton! – zzy Dec 21 '17 at 07:52
  • Probably, if it can be compiled on Windows, you'd be better off just using libidn2 and linking it statically. Still, the algorithm to implement is in public domain (see the RFC linked above), and libidn2 is open source, so if you want to implement it yourself you have plenty of inspiration material. – Matteo Italia Dec 21 '17 at 07:53
  • @MatteoItalia Yes, I know it is an open source library, but I don't want my source code opened, so the GPL license is what I don't want to use. I have taken a quick look at the libidn2 source code, seems it's not very easy to implement it by myself. – zzy Dec 21 '17 at 07:56
  • Libidn2 is LGPL, not GPL; essentially either you link it as a dll, or provide means to re-link a user provided version to your libcurl.dll. Opening your source is not needed at all. – Matteo Italia Dec 21 '17 at 08:02
  • @MatteoItalia Oh I have missed this, but LGPL needs libcurl to be used as dll, I want all denpendency libraries compiled as static library into my standalone dll file, so it still can not satisfy my requirement. – zzy Dec 21 '17 at 08:09

0 Answers0