OoliteProject / oolite

The main Oolite repository.
https://www.oolite.space
562 stars 73 forks source link

Game does not support proxy to download OXPs (Windows) #246

Open mwerle opened 7 years ago

mwerle commented 7 years ago

Obviously just a "quality-of-life" enhancement since people can manually download OXPs using a web browser, but it would be nice if the game download code could be expanded to use a defined proxy.

Either specify it on the command-line, use the "HTTP_PROXY" environment variable, or use the "System Proxy" (in that priority).

AnotherCommander commented 7 years ago

Is this some gnustep dependency that allows it? I am not sure how to reproduce or test this problem on Windows and, since we are using mostly the some codebase for OXP Manager downloads, I wonder if there is some library that's not getting included in the Windows gnustep linrary. If you can provide some more information on that (especially a test pattern), that would be great.

mwerle commented 7 years ago

I'm just at work, behind a corporate firewall/proxy (ie, non-proxy traffic cannot get out). Trying to download the OXP list times out (haven't tried packet sniffing yet). Haven't tried OXP Manager either, so not sure if that works.

Tried to set the "HTTP_PROXY" environment variable, but the current version of the game seems to have a problem launching from a command line, so not sure if that would've worked.

type Logs\Latest.log 2017-07-19 09:26:43.970 oolite[22960] NSBundle.m:1145 Assertion failed in NSBundle(instance), method mainBundle. NSInternalInconsistencyException

Unsure what, if anything, might be needed for Windows gnustep. I know some development environments automatically support proxies, others the developer needs to add specific code to support them.

I'll do some more digging and try out OXP Manager too.

mwerle commented 7 years ago

Um.. there's no standalone OXP Manager I can find; is that something obsolete, or did I misunderstand something?

mwerle commented 7 years ago

So basically NSURLConnection (which is used in the code; I just looked) -should- use the System Proxy, but possibly doesn't on Windows.

Coding support in would require using the lower-level CFURL classes - which would be non-trivial.

Possibly just in the "too hard" basket for now, and perhaps a newer version of gnustep does it properly on Windows (I saw there was some effort to move to a newer GNUStep underway).

The current Debian version of Oolite also fails to download the OXP list from behind a proxy.

AnotherCommander commented 7 years ago

Um.. there's no standalone OXP Manager I can find; is that something obsolete, or did I misunderstand something?

I guess I didn't express myself properly; to clarify, I was referring to the in-game OXP Manager and by "same codebase" I meant that both Linux and Windows use more or less the same code in OOOXZManager.m.

(I saw there was some effort to move to a newer GNUStep underway).

No such effort exists as far as I know.

mwerle commented 7 years ago

Ohwait, newer SDL :) NVM...

Artoria2e5 commented 4 years ago

So basically NSURLConnection (which is used in the code; I just looked) -should- use the System Proxy, but possibly doesn't on Windows.

Dug into the GNUstep Base ("Foundation") NSURLConnection thing a bit. It goes to NSURLProtocol for the actual loading, and ends up in a certain +[NSStream getStreamsToHost:port:inputStream:outputStream:] thing. Although Unix and Win32 has some different handling here, both go down to GSSocketStream.m, a bit too deep for HTTP proxys but enough for socks proxy at that level.

At the SocketStream level the inet streams, via their socket input/output parents, do have some trying with the GSSOCKS stuff for socks proxies, so that should work both on Unix and Win32. I don't really see how the whole NSStreamSOCKSProxyConfigurationKey thing was set at all, but the documentation does mention two env vars you can poke at there.


About the CF stuff on GS... CoreBase is, just, never good enough to be the basis for Base yet.

HiranChaudhuri commented 6 months ago

Meanwhile there is an altternative Expansion Manager: https://github.com/HiranChaudhuri/OoliteStarter/releases Is proxy support still required? How would an application detect a proxy shall be used?

Artoria2e5 commented 6 months ago

How would an application detect a proxy shall be used?

There is a vaguely existent concept of global proxy settings on Windows. It does not go through environment variables like on *nix; instead, it is technically the "Internet Explorer" proxy settings that you change in Internet Options. (For Windows 10 and up, the same thing is changed by the Proxy Settings in the Win+I settings app.)

Programs are generally expected to use these proxy settings. If a program uses WinHttp for its Http job, the IE settings are automatically applied if you use the flag WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY on WinHttpOpen(). If the program does not, it do either of the following to get the settings:

HiranChaudhuri commented 5 months ago

Give it a try. Fork the repository, apply the changes- Oolite will be built automatically by Github. If it works for you, run a pull request. :-)

HiranChaudhuri commented 5 months ago

Um.. there's no standalone OXP Manager I can find; is that something obsolete, or did I misunderstand something?

Meanwhile there is an altternative Expansion Manager: https://github.com/HiranChaudhuri/OoliteStarter/releases