Bug #51921 [Opn->Bgs]: CURLOPT_USERPWD bogus when use without username
| From: | degeberg@php.net | Date: | Thu, 27 May 2010 00:02:15 +0000 |
| Subject: | Bug #51921 [Opn->Bgs]: CURLOPT_USERPWD bogus when use without username | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-150857@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51921&edit=1
ID: 51921
Updated by: degeberg@php.net
Reported by: over at silversurfer7 dot de
Summary: CURLOPT_USERPWD bogus when use without username
-Status: Open
+Status: Bogus
Type: Bug
Package: cURL related
Operating System: Debian 5.0 64bit
PHP Version: 5.2.13
New Comment:
That would be an issue with libcurl then. PHP's curl extension just
passes the options to libcurl.
See:
http://svn.php.net/viewvc/php/php-src/trunk/ext/curl/interface.c?view=markup#l1707
Previous Comments:
------------------------------------------------------------------------
[2010-05-26 13:51:57] over at silversurfer7 dot de
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 this bug report at http://bugs.php.net/bug.php?id=51921&edit=1