With The Last of Us: Left Behind just around the corner I came to the realisation that downloading the multiple gigabyte DLC over my temporary home 3G Internet connection was not going to happen.

Since the Playstation 3 has an option to use a proxy server, I looked into the option of downloading large game updates and downloadable content with a download manager and a faster Internet connection. Once downloaded, I would add the file to the proxy server and when the PS3 goes to download the file, it would pull the file from the speedy proxy server instead of the Internet.

I tried downloading a few different PS3 proxy programs. I noticed all programs were only available for Windows and redirecting the PS3 to cached local downloads didn't seem to work.

Not ready to give up, I set up a Squid proxy and an Apache web server on a Mac mini.

Diagram.jpg


My plan was to use a Squid redirector to read incoming traffic and if the URL contained a filename of a locally cached file, redirect the PS3 to download the file from the local web server.

After reading the documentation on Squid PHP Redirectors, I took their template and I made the following script.

#!/usr/bin/php
<?php

// File repository URL
$repoAddress = "192.168.1.3/squidrepo/";

// Local path to repository
$repoPath = "/Library/WebServer/Documents/squidrepo";

// Scan directory for array of cached files
$files = new FilesystemIterator($repoPath, FilesystemIterator::KEY_AS_FILENAME);

// Define array temporary
$temp = array();

// Extend stream timeout to 24 hours
stream_set_timeout(STDIN, 86400);

while ($input = fgets(STDIN) ) {

// Split the output (space delimited) from squid into an array.
$temp = split(' ', $input);

// Set the URL from squid to a temporary holder.
$output = $temp[0] . "\n";

foreach ($files as $key => $file) {

// If filename exists in URL and is not coming from repository
if ((strpos($temp[0], $key) !== false) && (strpos($temp[0], $repoAddress) === false)) {

// Redirect client to repository download
$output = "http://" . $repoAddress . $key . "\n";

}

}

// Output the finial URL. If the file is not part of repository, do not alter URL.
echo $output;

}

?>

 

Testing it out using the PS3's web browser and a 'Making of The Last of Us' film, I could see it was working correctly. I had super fast downloads.

I then tried to download a game update that was cached on my local web server. This is where my luck ran out as I discovered the PS3 ignores proxy settings for game updates/DLC and connects straight to Sony, bypassing the proxy server altogether.

Connecting my laptop between the PS3 and my home network, I used Wireshark to capture the PS3's network traffic. I noticed the PS3 performs a HTTP HEAD request on downloads, before using HTTP GET to actually download the file. This lead me to believe the issue was due to slightly different headers coming from my local web server. I was able to compare the headers using the following two Terminal commands:

Official host header: curl -i -X HEAD http://<DOWNLOADURLHERE>
Local cache header: curl -i --proxy http://192.168.1.3:8080 -X HEAD http://<DOWNLOADURLHERE>

I then modified my Apache configuration to closely match the headers of the official host and tried the game update again. However, that did not help and reconfirmed that the PS3 will not download game updates through a proxy server.

 

Conclusion 

At the end of the day, my Squid redirector and web server make for a neat way of distributing files through a web browser, so all is not lost.

In theory, using an intercepting proxy between the PS3 and an Internet connection would trick the PS3 into thinking it is not using a proxy and would allow a redirect to a local web server. However, configuring an intercepting proxy feels like overkill compared to just taking the PS3 to somewhere with a decent Internet connection and installing any updates/DLC.

1 Comment