PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » PEAR » PEAR » Bug #1378

Need to urldecode password for http_proxy in pear installer

Details

Submitted2004-05-11 00:08 UTC
Fromi at camerongreen dot org
Assignedcellog
StatusClosed
PackagePEAR
PHP Version5.0.0RC1 (Release Candidate 1)
OSFedora
Roadmaps(Not assigned)

Comments

[2004-05-11 00:08 UTC] i at camerongreen dot org

Description:
------------
The Remote.php class in the PEAR installer does not urldecode
parameters after it parses the URL.

This means that if a password contains the wrong characters, it will
not work. For instance http://username:p@ssword@proxy.my.url.com will cause an error because the @ symbol in p@ssword will confuse it.

You therefore need to urlencode the @ to its entity equivalent, and after parse_url has seperated it in the code, urldecode it.

All this means for you is to run a urldecode on the proxy user name and password before you assign it to their vars.

Cheerio,

Cameron

Reproduce code:
---------------
Easy fix....you might want to put @ symbols in front of the function call though,

diff /usr/local/php/lib/php/PEAR/Remote.php /usr/local/php/lib/php/PEAR/Remote.php.old
138,139c138,139
< $proxy_user = urldecode(@$proxy['user']);
< $proxy_pass = urldecode(@$proxy['pass']);
---
> $proxy_user = @$proxy['user'];
> $proxy_pass = @$proxy['pass'];

[2004-05-11 00:57 UTC] i at camerongreen dot org

Sorry, should have searched through the code for similar problems. Here are updated diffs for Common.php and Remote.php

diff Remote.php Remote.php.old
138,139c138,139
< $proxy_user = urldecode(@$proxy['user']);
< $proxy_pass = urldecode(@$proxy['pass']);
---
> $proxy_user = @$proxy['user'];
> $proxy_pass = @$proxy['pass'];
209,210c209,210
< $proxy_user = urldecode(@$proxy['user']);
< $proxy_pass = urldecode(@$proxy['pass']);
---
> $proxy_user = @$proxy['user'];
> $proxy_pass = @$proxy['pass'];

[2004-05-11 00:58 UTC] i at camerongreen dot org

diff Common.php Common.php.old
1702,1703c1702,1703
< $proxy_user = urldecode(@$proxy['user']);
< $proxy_pass = urldecode(@$proxy['pass']);
---
> $proxy_user = @$proxy['user'];
> $proxy_pass = @$proxy['pass'];

[2006-10-27 08:44 UTC] list dot dhooge at gmail dot com

Since 2004, new uses of http_proxy appear and didn't include the url_decode call. This is currently the case in:
PEAR/Downloader.php - lines 1374-1375
PEAR/REST.php - lines 294-295