From:
Operating system: Debian 5.0 64bit
PHP version: 5.2.13
Package: cURL related
Bug Type: Bug
Bug description:CURLOPT_USERPWD bogus when use without username
Description:
------------
When using CURLOPT_USERPWD within a cURL request u have to provide both
username AND password to work properly.
I had a problem with accessing pages with Basicauth and NO username, just a
Password.
curl then calculates the base64 wrong.
As workaround i have to calculate the base64 manually and provide it to
curl via the headers option
Test script:
---------------
$curl = curl_init('http://localhost');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERPWD, ':password'); // no username
curl_setopt($curl, CURLOPT_VERBOSE, true);
$response = curl_exec($curl);
curl_close($curl);
Expected result:
----------------
something like this in the request headers:
"Authorization: Basic OnRlc3Q="
Actual result:
--------------
"Authorization: Basic Og=="
(only the ":")
--
Edit bug report at http://bugs.php.net/bug.php?id=51921&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51921&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51921&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=51921&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=51921&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51921&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51921&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51921&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51921&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51921&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51921&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51921&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51921&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51921&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51921&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51921&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51921&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51921&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51921&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51921&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51921&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51921&r=mysqlcfg