curl-and-php
bug with curl when use it for send POST file via http to a remote server
Date: Mon, 05 May 2014 21:27:33 +0400
Hello. Found very strange situation.
My system
uname -a >> Linux 3.2.0-60-generic #91-Ubuntu SMP Wed Feb 19 03:54:44 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
curl -V >> curl 7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
php -v >> PHP 5.3.10-1ubuntu3.10 with Suhosin-Patch (cli) (built: Feb 28 2014 23:14:25)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
code for sending file
========
$postdata = array(
'fileid' => $fileid,
'current_slice' => self::$_current_slice,
'current_chunk' => self::$_current_chunk,
'stream' => $stream,
'controller' => 'node',
'ctime' => $ctime,
'action' => 'upload',
'password' => Config::get('PASSWORD'),
'file' => "@".$upload
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, Config::get('connect_curl_timeout'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, $URL.'/index.php');
curl_setopt($ch, CURLOPT_PORT, Config::get('NODES_PORT'));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
=============
so, sending 2000 files into system, it is about 2000*3 *2/3 = 4000 times of execution code above(sending chunk of file to remote server)
and alltime it is about 5-15 erros
like these
errcode=26 errmsg=couldn't open file "Ё”e¦@cОў3„d"
PS - filename is different for different php processes.
====
extra doings
1)if error will appear, retry yet 3 times the same. - Result - the same error with the same filename "Ё”e¦@cОў3„d"
2)if error will appear, retry the same but without file - means sending just array of data via HTTP POST - Result - the same error with the same filename
3)use CURLOPT_VERBOSE
result:(log of the php process, other processes has others logs)
* About to connect() to t3.host.com port 80 (#0)
* Trying 204.45.182.26... * connected
* couldn't open file "ЇSGЧ^–8оЪЪЫбнМ"
* Connection #0 to host t3.host.com left intact
* Closing connection #0
* About to connect() to t3.host.com port 80 (#0)
* Trying 204.45.182.26... * connected
* couldn't open file "ЇSGЧ^–8оЪЪЫбнМ"
* Connection #0 to host t3.host.com left intact
* Closing connection #0
* About to connect() to t2.host.com port 80 (#0)
* Trying 50.7.10.98... * connected
* couldn't open file "ЇSGЧ^–8оЪЪЫбнМ"
* Connection #0 to host t2.host.com left intact
* Closing connection #0
ps other processes with error, has the same log file, exclude file name, other not-readable-filename
-- 4) if error will appear, try to get some file from remote node (useing HTTP GET) - it works, but any POST request doesn't works. PS according logs, I am sure, there are the situation, when php process has good sent the first chunk of the user file, but on the second one has error, and then for these php process it is impossible to send request via HTTP POST. Please, help me, what's up!? how can I fix it, how can I understand - what file is it like "ЇSGЧ^–8оЪЪЫбнМ" Alex Omelchuk
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2014-05-05