[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Synchronous Download Function (Win32)

Synchronous Download Function (Win32)

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Synchronous Download Function (Win32)

Postby Baker » Wed Jul 04, 2012 4:27 am

The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Synchronous Download Function (Win32)

Postby Spike » Wed Jul 04, 2012 11:17 am

Eww.

1: windows specific.
2: blocking, windows/input messages get nuked for the duration. TCP has a 2-hour timeout period.
3: gotos... and do{}while(0); with no breaks or continues or anything.
4: dependant upon internet exploder settings, external to your program (especially the 'enable cookies: prompt' option).
5: cookies+self-signed certs etc. Automatic prompt tries to appear but fails due to no window messages?


Yay.

1: https/ftp support
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Synchronous Download Function (Win32)

Postby Baker » Wed Jul 04, 2012 12:02 pm

The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Synchronous Download Function (Win32)

Postby Spike » Wed Jul 04, 2012 1:03 pm

there's an argument to disable the cookie ui, so that should help mitigate that.

popen+wget = yay... assuming you have wget installed.


with fte, I have some http+ftp download stuff that I wrote a while ago, using system sockets. I'm not going to claim that its perfect, but it works suffienctly for me. the biggest annoyance for me is that it lacks https support, but that's a general socket-layer annoyance and applies to certain other things like websockets+tcpconnect etc.
http itself is not an overly complicated protocol, but there's a lot of twiddles like redirects. any html resources with meta redirects are impossible to follow from a purely http aproach.

The windows-only thing isn't a major problem as you can always just #ifdef _WIN32 it anyway, with a fallback stub that just returns some sort of error. However, if you do intend to be portable, alternative implementations on different platforms are a pain. Its easier to test if its the same on all platforms.

You could always statically link. FTE statically links against zlib+libpng+libjpeg on windows, so no conflicts there.
Alternatively, app-controlled dynamic linking can be used as a way to query versions or to ensure that the whole thing doesn't blow up if someone shoved the wrong dll version in there.
Tbh, the biggest pain with dlls is with 32bit vs 64bit builds.
Statically linking will generally allow all the unused entrypoints of a library to be stripped out, giving smaller zip sizes etc, so there's more upsides to doing so than just the obvious.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Synchronous Download Function (Win32)

Postby mh » Wed Jul 04, 2012 5:21 pm

The Windows-only thing isn't that bothersome. Normally you'd write a wrapper interface around it that calls into whatever the appropriate API might be depending on your platform. This code can be seen as what the Windows version of that interface might look like.

The big problem is: where does the download mechanism get it's connection settings from? If you've a direct connection then that's cool, you just connect directly and it works. If you're behind a proxy or using dial-up (and remember that dial-up is still used by a lot of mobile broadband providers) then like it or not the connection settings have to be obtained from your browser (at least on Windows, no idea about other platforms) - because that's just the way things work (snarky comments about whether or not it was a good way to make things work won't change it).
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Synchronous Download Function (Win32)

Postby Spike » Wed Jul 04, 2012 6:53 pm

if windows' 'Internet Properties' control panel tool didn't jumble up internet access and IE browser settings, then the settings in there might actually be more useful for browsers sane people might choose to use. Sadly that stuff is all ie-specific rather than generally useful.
But yes, configuring http proxies in every single app that might communicate with the internet is a real pain.
Which I suppose is the real advantage of an http proxy over a NAT...
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Synchronous Download Function (Win32)

Postby taniwha » Wed Jul 04, 2012 11:33 pm

For avoiding dll issues: don't use dlls. Link statically. I do for QF (I cross-compile win32 bins using mingw in linux). All of QF's external deps (except opengl.dll) are statically linked.
Leave others their otherness.
http://quakeforge.net/
taniwha
 
Posts: 399
Joined: Thu Jan 14, 2010 7:11 am

Re: Synchronous Download Function (Win32)

Postby Baker » Thu Jul 05, 2012 1:06 am

The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Synchronous Download Function (Win32)

Postby taniwha » Thu Jul 05, 2012 1:55 am

For static linking, normally one would skip the .dll and use a .lib. Since curl and zlib are both buildable from source anyway, you should be able to build .libs for them.

Absolute worst case (and this might be the craziness you were trying to avoid): include the sources in your build tree and project.
Leave others their otherness.
http://quakeforge.net/
taniwha
 
Posts: 399
Joined: Thu Jan 14, 2010 7:11 am

Re: Synchronous Download Function (Win32)

Postby mh » Thu Jul 05, 2012 10:12 am

For a zlib replacement, Q3A has all the necessary code and you can just copy and paste.

stb_image is a nice option for many image formats, but it only does 8-bpp png last time I checked.
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Synchronous Download Function (Win32)

Postby taniwha » Thu Jul 05, 2012 10:20 am

Gotta love that about the quake engines being GPLed: code can migrate back and forth between them as necessary :)
Leave others their otherness.
http://quakeforge.net/
taniwha
 
Posts: 399
Joined: Thu Jan 14, 2010 7:11 am


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 2 guests