Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64466 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39546 invoked from network); 2 Jan 2013 07:15:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jan 2013 07:15:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.163 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.163 smtp163.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.163] ([67.192.241.163:51126] helo=smtp163.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/E1-12868-CAED3E05 for ; Wed, 02 Jan 2013 02:15:57 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp16.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id C0CD44092E; Wed, 2 Jan 2013 02:15:53 -0500 (EST) X-Virus-Scanned: OK Received: by smtp16.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 5EF8E40150; Wed, 2 Jan 2013 02:15:53 -0500 (EST) Message-ID: <50E3DEA8.3090509@sugarcrm.com> Date: Tue, 01 Jan 2013 23:15:52 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Pierrick Charron CC: Internals References: <4F5C5540.8010204@sugarcrm.com> <4F5D3569.8050307@sugarcrm.com> <50DE4A01.8050006@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] CURL file posting From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! I'm thinking maybe the best solution is to have a new class - say, CurlFile - and do this: $file = new CurlFile("myface.png", "image/png"); curl_setopt($ch, CURLOPT_POSTFIELDS, array("foo" => "bar", "picture" => $file); This would allow us to do two things: 1. Protect ourselves from injection since you can not inject objects (there's still a matter of serialized data, but this can be handled by the class itself). 2. Support much more options in the file - e.g., right now it does not support streams, but libcurl has CURLFORM_STREAM - maybe we could use it, or maybe just read in the stream data and use it as CURLFORM_BUFFER. Of course, that would not work for big files, but here we are able to use much more options than with old @-based API. Any holes in this idea? If not, I'll try to make an RFC for it. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227