|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-02 11:19 UTC] xmorueco at gmail dot com
Description:
------------
When you set cookiestore as Request Options, when finally pecl_http try to open file specified on cookiestore, it try to open an incorrect path file.
You can see strace/truss:
It seems that can open file for reading, but fails when try to open to save cookie results.
READ:
open("cookies/e58b84332af6bd90b4a1df39a1a4be3a", O_RDONLY|O_LARGEFILE) = 4
WRITE:
open("", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 ENOENT (No such file or directory)
It's works correctly in pecl_http-1.6.0, but fails in pecl_http-1.6.3 and now in pecl_http-1.7.0b1
Reproduce code:
---------------
$url=$argv[1]; // URL to check login
$postinfo=$argv[2]; // POST info: user_name=demo:password=demo
$cookiesDir='cookies/'; // Directory to save cookies
$requestOptions = array
(
'timeout' => 10,
'redirect' => 10,
'useragent' => 'Mozilla/4.0',
'cookiestore' => "$cookiesDir".md5($url)
);
$post=explode(":",$postinfo);
foreach ($post as $param) {
$value=explode("=",$param);
$postData[$value[0]]=$value[1];
}
$response = http_post_fields("http://$url", $httppostData, NULL, $requestOptions, $info);
Expected result:
----------------
pecl_http-1.6.0
READ:
open("cookies/e58b84332af6bd90b4a1df39a1a4be3a", O_RDONLY|O_LARGEFILE) = 4
WRITE:
open("cookies/e58b84332af6bd90b4a1df39a1a4be3a", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 0
Actual result:
--------------
pecl_http-1.6.3
READ:
open("cookies/e58b84332af6bd90b4a1df39a1a4be3a", O_RDONLY|O_LARGEFILE) = 4
WRITE:
open("", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 ENOENT (No such file or directory)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 18:00:01 2025 UTC |
I am running into the same issue on Ubuntu Server 9.10, PHP 5.2.10 and using the latest pecl_http package ( 1.7.0b2 ). I have no issue on windows however. We're defining our options like this: $POST_OPTIONS = array( 'httpauth'=>"$username:$password", 'httpauthtype'=>HTTP_AUTH_BASIC, 'timeout'=>'300', 'connecttimeout'=>'20', 'redirect'=>'3', 'cookiestore'=>COOKIE_FILE ); Where COOKIE_FILE = /tmp/cook.tmp After running: $page1 = http_post_data($CSI_URL, null, $POST_OPTIONS); Nothing is added to the cook.tmp file.