#44456 [Opn]: CURLOPT_URL error in parsing ftp url string given
| From: | felipe@php.net | Date: | Wed, 19 Mar 2008 02:34:31 +0000 |
| Subject: | #44456 [Opn]: CURLOPT_URL error in parsing ftp url string given | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123455@lists.php.net to get a copy of this message | ||
ID: 44456
Updated by: felipe@php.net
Reported By: sergiocrz at hotmail dot com
Status: Open
Bug Type: cURL related
Operating System: WinXP
PHP Version: 5.2.5
New Comment:
> Why is it expected that curl returns false
> ip when the url contains '#'?
AFAIK, the problem isn't the '#', but the '@'.
Previous Comments:
------------------------------------------------------------------------
[2008-03-19 02:28:19] sergiocrz at hotmail dot com
Why is it expected that curl returns false ip when the url contains
'#'?
If I use rawurlencode() to username and password CURL will consider
that encoded string as a new username and password, it will not be
decoded on exec. The returning error is: Access denied: 530. Thats
because the user and pass are incorrect...
By the results I have I still think there is a bug somewhere...
------------------------------------------------------------------------
[2008-03-19 00:09:18] felipe@php.net
This seems expected.
Normally app. accepts the format obtained for:
http://docs.php.net/manual/en/function.rawurlencode.php
Try using this function on login and password.
------------------------------------------------------------------------
[2008-03-17 16:27:31] sergiocrz at hotmail dot com
Description:
------------
When an ftp username or password uses the character "#" and when I try
to use it in
curl_setopt($ch, CURLOPT_URL,
"ftp://$ftp_user_name:$ftp_pass@$ftp_ip:$ftp_port$path");
cURL will not login with the correct user/pass combination nor the
correct IP.
Reproduce code:
---------------
// using ex: ftp://%e$U^&:!@#$5%@123.145.123.145:456
$ftp_user_name = "%e$U^&" ;
$ftp_pass = "!@#$5%" ;
$ftp_ip = "123.145.123.145";
$ftp_port = 456;
$path = "/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"ftp://$ftp_user_name:$ftp_pass@$ftp_ip:$ftp_port$path");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FTPLISTONLY, 0);
$result['filelist'] = curl_exec($ch); // content
$result['error'] = curl_error($ch);
$result['errno'] = curl_errno($ch);
Expected result:
----------------
Loggin in with the correct
$ftp_user_name = "%e$U^&" ;
$ftp_pass = "!@#$5%" ;
$ftp_ip = "123.145.123.145";
$ftp_port = 456;
Actual result:
--------------
cURL will connect to the IP: #$5%@123.145.123.145 as dysplayed by the
error.
As you can see the part before the ip "#$5%" belongs to the ftp_pass,
so I think when curl is parsing the url string and encounters "#"
(char(35)) it returns the wrong ip.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44456&edit=1