Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

5x download error when using &inline parameter

Hello,

I’m trying to track MP3 downloads on my site and when using the &inline parameter, the Downloads Pepper counts 1 download as 5. However when I use the &force parameter, the Downloads Pepper accurately counts each download as 1 download.

Can anyone help me remedy this issue?

Till
Third-Party Pepper Developer
Posted on Oct 24, '09 at 03:09 am

Try using &force&inline.

We added &force&inline and it still adds 5 requests per every download.

Till
Third-Party Pepper Developer
Posted on Oct 24, '09 at 06:31 pm

I’d need to take a look at your site and it’s .htaccess files, because no one every had such a problem before.

After further testing, with &force&inline I found that QuickTime X on Snow Leopard and windows media player respectively trigger 5 and 6 requests. Meanwhile, QuickTime 7 on both windows and mac triggers 1 request.

Hey Till, I was helping Adam out on this after turning him to Mint for tracking and I have some extra info that might be useful as I’ve been able to recreate the issue on my server. He’s on DreamHost and we can’t get access to today’s Apache logs until tomorrow which is where I thought we should look next.

In the meantime, I ran a test by placing one of his MP3s on my server and letting my Mint install do its thing. We’re using the same .htaccess rules in a parent “assets” folder which basically look something like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* http://pradador.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}&force&inline [L]

Next I visited the file with Safari on OS X 10.6 as that is one of the problem combinations and let the file load. Then I took a look at Mint and I found 5x hits as well.

Looking for more clues, I extracted the relevant details from my Apache log which are below:

189.152.136.227 - - [24/Oct/2009:23:39:03 +0000] "GET /assets/mp3/moses2.mp3 HTTP/1.1" 302 283 "http://pradador.com/assets/mp3/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9"
189.152.136.227 - - [24/Oct/2009:23:39:03 +0000] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://pradador.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 80970 "http://pradador.com/assets/mp3/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9"
189.152.136.227 - - [24/Oct/2009:23:39:04 +0000] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://pradador.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 13361162 "-" "Apple Mac OS X v10.6.1 CoreMedia v1.0.0.10B504"
189.152.136.227 - - [24/Oct/2009:23:39:04 +0000] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://pradador.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 13361162 "-" "Apple Mac OS X v10.6.1 CoreMedia v1.0.0.10B504"
189.152.136.227 - - [24/Oct/2009:23:39:04 +0000] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://pradador.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 13361162 "-" "Apple Mac OS X v10.6.1 CoreMedia v1.0.0.10B504"
189.152.136.227 - - [24/Oct/2009:23:39:06 +0000] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://pradador.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 13361162 "-" "QuickTime/7.6.3 (qtver=7.6.3;cpu=IA32;os=Mac 10.6.1)"

Parsing through them, it does indeed seem that the single request for the file is triggering 5 total requests for the file via the tracker. One from Safari, three from something called Core Media, and finally one from the QuickTime player. Might be worth noting they all have a 200 OK status code and the full file size.

Anyway, thought this info might be useful in finding a fix for the problem.

Here’s the relevant request logs from Adam’s Apache logs.

189.152.136.227 - - [24/Oct/2009:15:20:24 -0700] "GET /assets/mp3/moses2.mp3 HTTP/1.1" 302 653 "http://www.arttactic.com/podcast.php?id=9" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9" 
189.152.136.227 - - [24/Oct/2009:15:20:24 -0700] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://whitewallsareugly.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 70560 "http://www.arttactic.com/podcast.php?id=9" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9" 
189.152.136.227 - - [24/Oct/2009:15:20:24 -0700] "GET /favicon.ico HTTP/1.1" 200 276 "http://whitewallsareugly.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://whitewallsareugly.com/assets/mp3/moses2.mp3&force&inline" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9" 
189.152.136.227 - - [24/Oct/2009:15:20:24 -0700] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://whitewallsareugly.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 69120 "-" "Apple Mac OS X v10.6.1 CoreMedia v1.0.0.10B504" 
189.152.136.227 - - [24/Oct/2009:15:20:25 -0700] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://whitewallsareugly.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 69120 "-" "Apple Mac OS X v10.6.1 CoreMedia v1.0.0.10B504" 
189.152.136.227 - - [24/Oct/2009:15:20:25 -0700] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://whitewallsareugly.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 246240 "-" "Apple Mac OS X v10.6.1 CoreMedia v1.0.0.10B504" 
189.152.136.227 - - [24/Oct/2009:15:20:27 -0700] "GET /mint/pepper/tillkruess/downloads/tracker.php?url=http://whitewallsareugly.com/assets/mp3/moses2.mp3&force&inline HTTP/1.1" 200 2345760 "-" "QuickTime/7.6.3 (qtver=7.6.3;cpu=IA32;os=Mac 10.6.1)"
Till
Third-Party Pepper Developer
Posted on Oct 26, '09 at 07:32 am

Looks like QT is requesting additional chucks of the file, but I’m not very into streaming and these techniques.

I’ll see what I can do.

Thanks for your help.

Hey Till, couple notes:

First off, I noticed that one big difference between the five requests is that only the first one has a referrer (The link before the URL rewrite). The other four have no referrer since it seems Core Media/QuickTime ask for the new URL directly. Might be able to leverage that to discard repeat requests.

Second, is there anyway to add a random parameter to the rewrite URL via a mod_rewrite rule? If you could attach a random string to the end of the URL, then it’d be easy to exclude repeat random ids from counting as downloads.

Alright we fixed the problem on our end by doing a couple things. First I added a condition to the .htaccess file so that only requests that came from the podcast site would receive the &inline parameter. All other requests like direct links or downloads from iTunes just get the &force parameter.

Then I added a conditional around line 235 to the tracker code to discard inline requests without a referrer. That looks like this:

if (isset($_GET['inline'])) {
    if (!isset($_SERVER['HTTP_REFERER']) || empty($_SERVER['HTTP_REFERER']) || $_SERVER['HTTP_REFERER'] == "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) {
        $record = FALSE;
    }
}

That pretty much gives us the inline functionality when needed without the added download records.

Till
Third-Party Pepper Developer
Posted on Oct 28, '09 at 05:39 am

Don’t forget that some browsers don’t send a HTTP Referrer and that users have the option to disable the sending of it.

Another, cleaner idea would be writing a module for the Downloads Pepper, which could just ignore all request with your desired characteristics. You can just copy the ‘http’ module as a base. Otherwise, you’d have to update the source files upon every update. Take a look at the phpbb3 module docs.

You must be logged in to reply. Login above or create an account