Issue 1390 - Record referrer for download stats

--HG--
extra : amend_source : ce64f6c5e28da6193c7eb33bd0a8daf26fa2b23a
extra : histedit_source : e2069df1893dc0e907893237aef65d27bd803a76
Issue 1426 - Don't ignore redirects during stats processing