Bug 3077 - Curl does not allow redirecting
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: 1.33 SVN
Hardware: PC All
: P2 minor
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2007-04-03 18:32 EDT by Erik
Modified: 2007-05-21 22:25:11 EDT
1 user (show)

See Also:



Description Erik 2007-04-03 18:32:38 EDT
When the server that sv_dlurl points to redirects to another location, curl does not do it.

Here's a patch for it:
--- ioq3-svn/code/client/cl_curl.c	Tue Jan 23 11:39:50 2007
+++ ioUrbanTerrorSource/code/client/cl_curl.c	Sun Apr  1 16:38:54 2007
@@ -281,6 +281,7 @@
 			"%s for writing\n", clc.downloadTempName);
 		return;
 	}
+	qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
 	qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, clc.download);
 	if(com_developer->integer)
 		qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1);

Might also want to put the maxredirects option in, since by default, it's unlimited.
Comment 1 Hobbes 2007-04-04 01:52:39 EDT
i would suggest setting CURLOPT_MAXREDIRS to 20, at least that is what firefox defaults to.
Comment 2 Tony J. White 2007-04-25 01:32:09 EDT
I'm not against enabling this functionality, but I have some concern about why it is necessary and more importantly what types of mischief it could allow (if any).  Is there a legitimate reason for doing a redirect instead of just giving the proper sv_dlURL setting (e.g. required for some type of RewriteRule)?
Comment 3 Erik 2007-04-26 06:13:52 EDT
I got this request specifically from a game server admin.

The reason for him using it has to do with obscuring afaik. Makes it a little harder for people to leech his download folder. 

Maybe not a legitimate reason, but as I don't see any downsides, I don't mind that.
Comment 4 M. Kristall 2007-04-30 01:34:04 EDT
(In reply to comment #2)
> I'm not against enabling this functionality, but I have some concern about why
> it is necessary and more importantly what types of mischief it could allow (if
> any).  Is there a legitimate reason for doing a redirect instead of just giving
> the proper sv_dlURL setting (e.g. required for some type of RewriteRule)?
> 

The legitimate reason for redirects is leeching off other servers. E.g., using a mirror selection script or redirecting to a server with more bandwidth for maps you know it has.

I can't think of any negatives with allowing redirects (if the maximum number of redirects is limited), but a whole lot of potential positives.


(In reply to comment #1)
> i would suggest setting CURLOPT_MAXREDIRS to 20, at least that is what firefox
> defaults to.
> 

If you're concerned, 5 should be safe (from http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html):
>      Note: previous versions of this specification recommended a
>      maximum of five redirections. Content developers should be aware
>      that there might be clients that implement such a fixed
>      limitation.
Comment 5 Ryan C. Gordon 2007-05-21 11:22:37 EDT
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.

--ryan.

Comment 6 Tony J. White 2007-05-21 22:25:11 EDT
added at revision 1087