218 auto downloads rFCmp files now

Discussion in 'General Discussion' started by Noel Hibbard, May 21, 2013.

  1. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Some of you may have noticed that 218 has the ability to autodownload missing rFCmp files now. When you build an rFCmp file you will notice there is a place to put in a URL. This URL is used for the auto download process. The game takes that URL and then appends ?sig=<sig> where sig is the Submit ID you get when you package your rfcmp. If you notice all of ISI's new rfcmp files have http://rfactor.net/downloads/getmod.php as the URL. Their PHP file dynamically servs up the correct rfcmp file depending on what the sig parameter has.

    So for us to take advantage of this we are going to need a server that can respond to this sig parameter. I haven't tried it yet but I am thinking we could create a website that does a redirect to another server based on the sig. So the game goes to one URL and then redirects to another. The server hosting the getmod.php will have very little load on it.

    I will do some testing later and see how it goes.

    Edit: I have a fully functional system now. You can read a simple totorial on how to use it here: http://isiforums.net/f/showthread.p...FCmp-files-now?p=171922&viewfull=1#post171922
     
    Last edited by a moderator: May 22, 2013
  2. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Well I did a fresh install with no mods and was able to join a server that had only ISI content. It downloaded the vmod and then showed me all the rfcmps that were missing and then gave me an option to download the missing dependancies which worked perfect.

    Next step was to make an rFCmp file of my own with a valid URL and then package it into a vmod and host it on my own server. I am unable to test because it looks like get mod doesn't work if the dedicated server and client are on the same local network.

    Anyways, what I did was build a simple PHP file of my own which redirects my sig to dropbox.

    Here is my PHP file which I just named getmod.php like ISI did:
    Code:
    <?php
    	if (isset($_GET['sig']))
    	{
    		switch($_GET['sig'])
    		{
    			case "ff88e05ae8a50d8530b88c506ef8c683fbd92965b5d7e48a0641ca6cc043e12c":
    				header('Location: https://dl.dropbox.com/s/jz0dl2cbft30orz/NoelsSkin.rfcmp?v=0mcns');
    				break;
    			default:
    				echo "Unknown SIG";
    		}
    	}
    	else
    	{
    		echo "Missing SIG";	
    	}
    ?>
    
    I just hard coded this for now. If this test works I would make it database driven using MySQL and build a front end for adding new sigs.
     
  3. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    I moved my dedicated server off site so GetMod would work. It downloads the vmod and then lists the missing rfcmps. It gets the ISI stuff correctly but if fails to download mine. The URL it displays is right and it works if I paste it in a web browser. Looks like ISI needs to beef up their HTTP client some more as it looks like it doesn't understand redirects. This is a shame. So close to getting auto downloads to work. :(
     
    Last edited by a moderator: May 21, 2013
  4. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Here are the a few entries in my web server's log:
    Code:
    2013-05-21 03:13:45 10.18.1.2 GET /getmod.php sig=ff88e05ae8a50d8530b88c506ef8c683fbd92965b5d7e48a0641ca6cc043e12c 80 - 10.1.1.30 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.31+(KHTML,+like+Gecko)+Chrome/26.0.1410.64+Safari/537.31 302 0 0 327
    2013-05-21 03:23:39 10.18.1.2 GET /getmod.php sig=ff88e05ae8a50d8530b88c506ef8c683fbd92965b5d7e48a0641ca6cc043e12c 80 - 10.18.1.1 ISI+nMotor 302 0 0 78
    
    The first request was me testing the link in Chrome. It redirects to dropbox perfect. The second request is from rF2 and it fails.

    I hope ISI can add support for redirects. This would allow me to make a simple website for people to link their SubmitIDs to their download URLs.
     
  5. Banger

    Banger Registered

    Joined:
    Oct 26, 2011
    Messages:
    271
    Likes Received:
    0
    Thanks Mr hibbard for your Dedication, I hope so too.
     
  6. kimikaze

    kimikaze Registered

    Joined:
    Feb 17, 2011
    Messages:
    650
    Likes Received:
    23
    +1
     
  7. WiZPER

    WiZPER Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,517
    Likes Received:
    186
    I really hope we can make this happen, good job so far, Noel :D
     
  8. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    3rd party hosts are supported but only if they understand what to do with the "sig" parameter that is appended on the URL. So for it to work you would need a full blown web host that supports PHP. I rent a server for $3.99 a month. An expense like this wouldn't be horrible for a league to do.

    Btw, FTP isn't supported. Which is understandable. FTP has a slew of problems that would have to be worked out.

    One other thing I haven't tried yet is setting the URL in my rfcmp to the full Dropbox URL and see if Dropbox will just ignore the extra "sig" parameter that rF appends. The problem is Dropbox is most likely a redirect also.
     
  9. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Well I tried adding the sig to the end of a DB link and DB ignores the extra trash and downloads anyways. So theoretically it should work. So I repackaged all my junk with the new URL and rF still will not download it. Most likely because it is also a redirect. I need to use a tool like Fiddler to see what really happens when you use that link. I will do that later today.

    Here is my sample Dropbox link that ISI can test on:
    http://dl.dropbox.com/s/jz0dl2cbft3...c905f6fccae57fd942cfb5e38df3abdfde2c84eb1473d

    You can see rF2 try to download it 5 times and then it gives up. But this link works perfect in a browser. I also notice there is a limit to the length of the URL field in MAS2.exe where it crashes if you paste a long link.
     
  10. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Just looked with Fiddler and my link above is also a 302 redirect. I think the best solution is to support redirects.
     
  11. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    I just used Fiddler to look at ISI's getmod.php and it is also a 302 redirect. So maybe it has something to do with Dropbox. I am doing a redir to Dropbox who does another redir. I am going to put the file on a different host. My goal was to be able to redir to a very common (and free) host like Dropbox.
     
  12. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Success! I went back to my old getmod.php but rather than redirecting to a Dropbox link I redirected to a web host that directly servs the file without any other magic.

    It would still be nice if ISI could investigate why you can't pull files from Dropbox.

    FYI, by default when you build a Dropbox link it will look somthing like this:
    https://www.dropbox.com/s/jz0dl2cbft30orz/NoelsSkin.rfcmp

    If you use that link it will take you to a preview page which I would never expect ISI to be able to handle. But if you change the www to dl it will directly download. Also, you can and probably have to change the https to http for rF2's client to work. So the correct link will look like this:
    http://dl.dropbox.com/s/jz0dl2cbft30orz/NoelsSkin.rfcmp

    If ISI can get rF2's client to work with that link, that would be great!
     
  13. 1959nikos

    1959nikos Registered

    Joined:
    Mar 26, 2012
    Messages:
    3,915
    Likes Received:
    83
    What a breakthrough!!
    Congrats!!
     
  14. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    I tried Google Drive... no go because they only support HTTPS. Skydrive works though. The only problem is it isn't as easy to get direct download links that bypass the preview page as it is with Dropbox.

    I can confirm that rF2's client only supports HTTP and not HTTPS. Which is reasonable. I could probably modify my getmod.php to let me assign a SubmitID to a Skydrive link and automatically parse the preview page to extract the real direct link and then redirect rF2 to that link.
     
  15. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Duh, further inspection. Dropbox doesn't work because it redirects to HTTPS. So in the end nothing is really wrong with rF2. You just need to be sure you redirect to a host that supports HTTP. Skydrive is the first one I have found so far.
     
  16. Hedlund_90

    Hedlund_90 Registered

    Joined:
    Apr 12, 2012
    Messages:
    1,684
    Likes Received:
    41
  17. BrokkelPiloot

    BrokkelPiloot Registered

    Joined:
    May 19, 2012
    Messages:
    188
    Likes Received:
    1
    Great work Noel! How about Mega? They have awesome bandwidth!
     
  18. BigDuke6

    BigDuke6 Registered

    Joined:
    Jan 12, 2012
    Messages:
    139
    Likes Received:
    73
    Yes great work Noel, a very smart young man indeed, your parents there look very proud of you, well done. ;)
     
  19. Denstjiro

    Denstjiro Registered

    Joined:
    Oct 6, 2010
    Messages:
    2,952
    Likes Received:
    14
    Great stuff Noel :)
     
  20. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Does Mega have direct download links without ads or preview pages? Also, do they force the download to use HTTPS. These are the requirements.
     

Share This Page