Bug 529214 - rpm --httpproxy does not work
Summary: rpm --httpproxy does not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 11
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-15 14:37 UTC by philippe.combes
Modified: 2010-01-08 19:57 UTC (History)
3 users (show)

Fixed In Version: 4.7.2-1.fc11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-01-08 19:57:36 UTC
Type: ---


Attachments (Terms of Use)

Description philippe.combes 2009-10-15 14:37:25 UTC
Description of problem:

I have in my yum.conf
    proxy=http://proxy.<domain>:3128
and in my /etc/wgetrc:
    http_proxy=http://proxy.<domain>:3128
yum and wget both work well.

I tried to configure rpm likewise, with a file /etc/rpm/macros.proxy:
    %_httpproxy     proxy.<domain>
    %_httpport      3128
rpm cannot retrieve the package.

I tried directly
    # rpm -iv --httpproxy proxy.<domain> --httpport 3128 http://download.fedora.redhat.com/pub/….rpm
    Retrieving http://download.fedora.redhat.com/pub/....rpm
    curl: (7) couldn't connect to host
    error: skipping http://download.fedora.redhat.com/pub/….rpm - transfer failed

On the proxy, no connection is registered, and while it was attempting to retrieve the package, I ran a 'ps -edf': I saw then the curl command without any --proxy option. It is a pity, because
    curl --proxy proxy.<domain>:3128 download.fedora.redhat.com
works well.

Last but not least, if I set http_proxy variable in the environment, rpm works fine (with or without the --httpp* options)



Version-Release number of selected component (if applicable):
4.7.1

How reproducible:
Always.

Steps to Reproduce:
1. Set a proxy listening on port 3128.
2. Have a machine behind that proxy, that cannot connect to the internet but through the proxy.
3. On this machine, make sure http_proxy is not set and run
 rpm --httproxy <your proxy> --httpport 3128 -i <package Internet URL>
  
Actual results:
Cannot retrieve package

Expected results:
Installation successful.

Additional info:
Apart from reminding that yum, wget and curl are working fine, I see nothing else to report.

Comment 1 Panu Matilainen 2009-10-16 13:44:54 UTC
Nod, the proxy config just never got rewired after changing rpm to call out to curl for remote file retrieval. Aint hard to fix, for now you can either
a) use http_proxy environment (which curl honors)
b) set the proxy in ~/.curlrc
c) override default %__urlhelperopts in ~/.rpmmacros to include proxy options (this gets passed directly to curl)

Comment 2 philippe.combes 2009-10-16 15:55:01 UTC
Your c) solution should match my requirements. Thank you very much.
Where is it documented, please ?
If the value is passed as curl options, then the following should be OK for me, right ?

%__urlhelperopts --proxy proxy.<domain>:3128

Comment 3 Panu Matilainen 2009-10-22 07:05:13 UTC
It's only "documented" at the end of /usr/lib/rpm/macros (in other words, its not). What you want is to grab the default value from /usr/lib/rpm/macros and add your own needs to that, eg:

%__urlhelperopts        --proxy proxy.<domain>:3128 --silent --show-error --fail --location -o

Note that -o needs to be last on that line, as a temporary file name will follow that when called by rpm.

Comment 4 philippe.combes 2009-10-26 12:07:45 UTC
It still does not work, and I can't find why. I am sorry to come back to you.
Please have a look at the following commands.

# cat /etc/rpm/macros.proxy
# Proxy macros

%__urlhelperopts    --proxy proxy.<domain>:3128 -v --show-error --location -o


# rpm -iv http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpm
Retrieving http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpm
* About to connect() to proxy proxy.<domain> port 3128 (#0)
*   Trying 172.16.113.115... connected
* Connected to proxy.<domain> (172.16.113.115) port 3128 (#0)
> GET http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpm
>  HTTP/1.1
> User-Agent: curl/7.19.6 (x86_64-redhat-linux-gnu) libcurl/7.19.6 NSS/3.12.4.1 Beta zlib/1.2.3 libidn/1.9 libssh2/1.0
> Host: download.fedora.redhat.com
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Empty reply from server
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connection #0 to host proxy.<domain> left intact

curl: (52) Empty reply from server
* Closing connection #0
error: skipping http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpm - transfer failed


# curl --proxy proxy.<domain>:3128 -v --show-error --location -o test http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpm
* About to connect() to proxy proxy.<domain> port 3128 (#0)
*   Trying 172.16.113.115... connected
* Connected to proxy.<domain> (172.16.113.115) port 3128 (#0)
> GET http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpm HTTP/1.1
> User-Agent: curl/7.19.6 (x86_64-redhat-linux-gnu) libcurl/7.19.6 NSS/3.12.4.1 Beta zlib/1.2.3 libidn/1.9 libssh2/1.0
> Host: download.fedora.redhat.com
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 26 Oct 2009 11:46:42 GMT
< Server: Apache
< Last-Modified: Tue, 10 Mar 2009 02:44:20 GMT
< ETag: "1b1f0da-17fdc-ba5a0900"
< Accept-Ranges: bytes
< Content-Length: 98268
< Content-Type: application/x-rpm
< X-Cache: MISS from proxymaster.<domain>
< X-Cache-Lookup: MISS from proxymaster.<domain>:3128
< X-Cache: MISS from frontale-tlse.<domain>
< X-Cache-Lookup: MISS from frontale-tlse.<domain>:3128
< Via: 1.1 proxymaster<domain>:3128 (squid/2.7.STABLE3), 1.0 frontale-tlse.<domain>:3128 (squid/2.6.STABLE13)
* HTTP/1.0 proxy connection set to keep alive!
< Proxy-Connection: keep-alive
< 
  0 98268    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0{ [data not shown]
100 98268  100 98268    0     0  77858      0  0:00:01  0:00:01 --:--:-- 77990* Connection #0 to host proxy.<domain> left intact

* Closing connection #0


# rpm -iv http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpmRetrieving http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpm
* About to connect() to proxy proxy.<domain> port 3128 (#0)
*   Trying 172.16.113.115... connected
* Connected to proxy.<domain> (172.16.113.115) port 3128 (#0)
> GET http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64/os/Packages/MAKEDEV-3.24-3.x86_64.rpm
>  HTTP/1.1
> User-Agent: curl/7.19.6 (x86_64-redhat-linux-gnu) libcurl/7.19.6 NSS/3.12.4.1 Beta zlib/1.2.3 libidn/1.9 libssh2/1.0
> Host: download.fedora.redhat.com
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
{ [data not shown]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 97983    0 97983    0     0  6949k      0 --:--:-- --:--:-- --:--:-- 7996k* Connection #0 to host proxy.<domain> left intact

* Closing connection #0
Preparing packages for installation...
	package MAKEDEV-3.24-3.x86_64 is already installed



Conclusion: curl must not be called with exactly the same options as my %__urlhelperopts. The last command was to help you find the issue: I have a nscd running on the host. Once curl has succeeded in downloading the package once, then the subsequent calls to rpm succeed in retrieving the package: called by rpm, curl can access the cached downloads, but still not the remote package.

I have checked my environment variables: none is related to proxys.

Have you got any other clue for me ?

Thanks for the time you spend on this...

Comment 5 Fedora Update System 2009-12-23 09:11:38 UTC
rpm-4.7.2-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/rpm-4.7.2-1.fc11

Comment 6 Fedora Update System 2009-12-23 21:32:44 UTC
rpm-4.7.2-1.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update rpm'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-13589

Comment 7 Fedora Update System 2010-01-08 19:57:23 UTC
rpm-4.7.2-1.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.