[devscripts] 01/01: uscan: Remove Referer header when using SF redirector

James McCoy jamessan at debian.org
Thu Oct 9 03:14:33 UTC 2014


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit fb0e6a67fc059acb89cf0ea7bc9b52cad43d5326
Author: James McCoy <jamessan at debian.org>
Date:   Wed Oct 8 23:14:13 2014 -0400

    uscan: Remove Referer header when using SF redirector
    
    Closes: #764367
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog | 10 ++++++++--
 scripts/uscan.pl | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 00e8ec0..74d70f2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
 devscripts (2.14.8) UNRELEASED; urgency=medium
 
   [ James McCoy ]
-  * uscan: Ensure $keyring is defined before trying to use it when checking
-    whether the upstream keyring exists.
+  * uscan:
+    + Ensure $keyring is defined before trying to use it when checking whether
+      the upstream keyring exists.
+    + Strip the Referer header when using qa.debian.org's Sourceforge
+      redirector.  When there's a foreign Referer header, Sourceforge responds
+      with a web page containing a <meta refresh=...> redirect to the actual
+      file, causing uscan to save the web page rather than the file.  (Closes:
+      #764367)
 
   [ Ron Lee ]
   * cowpoke: Add --sign and --upload command line overrides.
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index d9e1304..4456a7c 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -431,6 +431,16 @@ package main;
 my $user_agent = LWP::UserAgent::UscanCatchRedirections->new(env_proxy => 1);
 $user_agent->timeout($timeout);
 $user_agent->agent($user_agent_string);
+# Strip Referer header for the sf.net redirector to avoid SF sending back a
+# 200 OK with a <meta refresh=...> redirect
+$user_agent->add_handler(
+    'request_prepare' => sub {
+	my ($request, $ua, $h) = @_;
+	$request->remove_header('Referer');
+    },
+    m_hostname => 'qa.debian.org',
+    m_path_prefix => '/watch/sf.php',
+);
 
 if (defined $opt_watchfile) {
     uscan_die "Can't have directory arguments if using --watchfile" if @ARGV;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list