mldonkey: HTTPS support


In the last months, I decided to contribute a new feature to the mldonkey open source project: HTTPS support.

Apparently, mldonkey never supported HTTPS: while this limitation could be acceptable many years ago, it is now a considerable drawback. In particular, it makes it almost impossible to download files from the web (like the IP map to geolocate IPs) and to download torrents, where trackers frequently use the HTTPS protocol.

Solution

mldonkey did not seem to use specific libraries for implementing its HTTP client: the implementation only uses TCP socket and strings. Best option would be to integrate HTTPS by using well-known libraries implementing the protocol. HTTPS uses TLS to encrypt data, and TLS uses multiple asymmetric and symmetric encryption algorithms.

The solution I found more reasonable was to reimplement the HTTP client functions using a library that supports encryption protocols.

For ocaml, it seemed that ocurl could be a solution, and is also included in some distributions like Ubuntu.

Implementation

I implemented the new solution by simply keeping the old interface of the http module, and I rewrote it using ocurl. The patch is being worked on here: https://github.com/ygrek/mldonkey/pull/127.

The patch is not yet included in the official repo. If you want to build mldonkey with the HTTPS patch, you can use my fork here: https://github.com/carlonluca/mldonkey.

Result

With this patch, it is now possible for mldonkey to connect to HTTPS servers in every part of the mldonkey code where the http module was used before. This means it can now download the GeoIP database and other tools it needed or to use HTTPS torrent trackers.

FileTP is another plugin used by mldonkey, with which you can download large files. In this case, unfortunately, mldonkey had a second implementation of HTTP. I did not add HTTPS support for FileTP.

The GeoIP database could not be updated before this patch. If you add this patch and use a recent URL for the GeoIP database like https://dl.miyuru.lk/geoip/maxmind/country/maxmind4.dat.gz, you can get updated country codes:

Docker

My docker image includes this patch (on top of others) that are not included elsewhere: https://hub.docker.com/r/carlonluca/mldonkey. The fork from which the image is built can be found here: https://github.com/carlonluca/mldonkey.

Refer to this page to know what versions include this patch.

Leave a Reply

Your email address will not be published. Required fields are marked *