megaglest-source icon indicating copy to clipboard operation
megaglest-source copied to clipboard

The Future of the Feathery/FTP library in MegaGlest

Open Jammyjamjamman opened this issue 4 years ago • 9 comments

As @tomreyn stated about feathery in #197 :

Yet another option would be to replace the feathery lib and all calls to it (won't be few) code by just libcurl (HTTP/FTP client, MG already uses it), and a small HTTP server for the host part. I don't think MG ever uploads via FTP, just downloads, so that's probably a sufficient, and probably much better, alternative. I assume it would be a backwards incompatible change, though. And would likely involve an amount of work. FTP really deserves to R.I.P., though.

Our options for feathery are therefore:

  • Leave it as it is.
  • Get rid of feathery ftp and either replace it with curl (which is already a dependency to MegaGlest) or get rid of ftp entirely in the code.

Jammyjamjamman avatar Jun 26 '20 23:06 Jammyjamjamman

* Get rid of feathery ftp and either replace it with curl (which is already a dependency to MegaGlest) or get rid of ftp entirely in the code.

Right now, feathery is used as an ftp server to serve maps, mods, etc, and curl is used to download. Is that right?

I was just reading through the libcurl docs a little, and see that it can be used to transfer data to and from a server, but I don't get the impression it can be used as a "server", even though it can send. So basically, if the client were using curl to retrieve a file from an MG host, the MG host could not send it with curl.

Some comments about it and a few options for http server libs at

https://stackoverflow.com/a/32559308/6838037

andy5995 avatar Jun 27 '20 19:06 andy5995

Right now, feathery is used as an ftp server to serve maps, mods, etc, and curl is used to download. Is that right?

I am convinced this is correct.

I was just reading through the libcurl docs a little, and see that it can be used to transfer data to and from a server, but I don't get the impression it can be used as a "server", even though it can send. So basically, if the client were using curl to retrieve a file from an MG host, the MG host could not send it with curl.

I agree. I'm convinced that libcurl does not implement any HTTP or FTP servers nor does it provide functionality for this purpose. You can use the HTTP (and likely also FTP) client code it provides to have a client send data (HTTP POST, FTP upload) to a server, but this is not relevant here, a MegaGlest instance hosting a game needs to host file downloads for connected game clients.

Some comments about it and a few options for http server libs at

https://stackoverflow.com/a/32559308/6838037

More small footprint HTTP servers could probably be found in Debian, or using a web search engine looking for, e.g. ( "http server" OR "httpd" ) AND ( small OR tiny OR minimal OR micro ) Replacing the FTP server code by HTTP server code would not entirely overcome the need for port forwarding, but would make things less terrible. HTTP downloads need exactly one port forwarded (or two at most if you do HTTP+HTTPS).

This said, there are certainly more pressing issues in MegaGlest, if it is to live much longer, such as a need for IPv6 support.

tomreyn avatar Jun 28 '20 15:06 tomreyn

Related: MegaGlest is going to be removed off Debian because it fails to build from source (FTBFS):

megaglest 3.13.0-5 is marked for autoremoval from testing on 2020-09-01

It is affected by these RC bugs: 966892: megaglest: FTBFS: ld: ../shared_lib/liblibmegaglest.a(ftpAccount.c.o):./obj-x86_64-linux-gnu/source/shared_lib/./source/shared_lib/include/feathery_ftp/ftpTypes.h:84: multiple definition of `ftpIsClientAllowedToGetFile'; /usr/bin/ld: DWARF error: could not find variable specification at offset f7c1 https://bugs.debian.org/966892

tomreyn avatar Aug 11 '20 07:08 tomreyn

I am on the other side of Canada this week, would you guys want me to get these issues fixed next week?

-- Edit: Removed quote + promotional message

softcoder avatar Aug 11 '20 17:08 softcoder

Fixed how? But certainly any fix you can provide would be great to have!

tomreyn avatar Aug 11 '20 18:08 tomreyn

I will try to look at fixing the issues next week so that it won't get pulled

-- Edit: Removed quote + promotional message

softcoder avatar Aug 11 '20 18:08 softcoder

@softcoder , @Jammyjamjamman committed the feathery_ftp fix in https://github.com/MegaGlest/megaglest-source/commit/5a3520540276a6fd06f7c88e571b6462978e3eab and I've got a PR that adds a test for building with g++-10 (rebased after the feathery patch).

andy5995 avatar Aug 11 '20 21:08 andy5995

Ok so what remains to be fixed?

-- Edit: Removed quote + promotional message

softcoder avatar Aug 11 '20 21:08 softcoder

In order to build on Debian testing/bullseye? I think that's it. As for Debian Sid, there's issue #196. Though #198 could be a problem soon as well.

andy5995 avatar Aug 11 '20 22:08 andy5995