Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 28807 - gentoo-stats does not work through proxy that requires authentication
Summary: gentoo-stats does not work through proxy that requires authentication
Status: RESOLVED DUPLICATE of bug 30923
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Heinrich Wendel (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-15 10:37 UTC by Sergey Starosek
Modified: 2005-07-17 13:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Starosek 2003-09-15 10:37:48 UTC
it either tries to connect directly to port 80 or through proxy
if HTTP_PROXY is set in /etc/gentoo-stats/gentoo-stats.conf.

gentoo-stats-0.4

Reproducible: Always
Steps to Reproduce:
1. Just run gentoo-stats while being behind proxy
2.
3.




proposed solution is to add HTTP_PROXY_USER and HTTP_USER_PASS to conf file
and handle it like that:

--- /usr/sbin/gentoo-stats      2003-09-15 09:28:33.000000000 +0300
+++ ./gentoo-stats      2003-09-15 20:09:16.000000000 +0300
@@ -472,6 +472,8 @@
   %conf->{'EMAIL'} = '';
   %conf->{'ALLOW_DEVS'} = 0;
   %conf->{'HTTP_PROXY'} = '';
+  %conf->{'HTTP_PROXY_USER'} = '';
+  %conf->{'HTTP_PROXY_PASS'} = '';
 
   open(FILE, '/etc/gentoo-stats/gentoo-stats.conf') ||
     die('couldn\'t open /etc/gentoo-stats/gentoo-stats.conf');
@@ -530,6 +532,14 @@
       {
         %conf->{'HTTP_PROXY'} = $val;
       }
+      elsif ($key eq 'HTTP_PROXY_USER')
+      {
+        %conf->{'HTTP_PROXY_USER'} = $val;
+      }
+      elsif ($key eq 'HTTP_PROXY_PASS')
+      {
+        %conf->{'HTTP_PROXY_PASS'} = $val;
+      }
     }
   }
 
@@ -567,7 +577,12 @@
   {
     $ua->proxy('http', %config->{'HTTP_PROXY'});
   }
-  $resp = $ua->request(GET 'http://stats.gentoo.org/servlet/org.gentoo.stats.NewUserServlet');
+  $req = HTTP::Request->new('GET','http://stats.gentoo.org/servlet/org.gentoo.stats.NewUserServlet');
+  if (%config->{'HTTP_PROXY_USER'} ne '')
+  {
+    $req->proxy_authorization_basic(%config->{'HTTP_PROXY_USER'}, %config->{'HTTP_PROXY_PASS'});
+  }
+  $resp = $ua->request($req);
   $s = $resp->content;
 
   if ($s =~ /Your new system ID is/s)
Comment 1 Heinrich Wendel (RETIRED) gentoo-dev 2003-10-11 13:11:12 UTC

*** This bug has been marked as a duplicate of 30923 ***