Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85866 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27515 invoked from network); 18 Apr 2015 21:35:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2015 21:35:47 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.43 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.43 mail-pa0-f43.google.com Received: from [209.85.220.43] ([209.85.220.43:33661] helo=mail-pa0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/00-27014-33EC2355 for ; Sat, 18 Apr 2015 17:35:47 -0400 Received: by paboj16 with SMTP id oj16so163789101pab.0 for ; Sat, 18 Apr 2015 14:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=7cjeceU1fK/DYWvBD+CAudcXbcHow4oqdrXOYjf8l9E=; b=Dtqe0y/W1WNvw/WSb3byM8A/NwSpVKKg1MK/8HIbLqv3ukb6M82FZoS0GxZ3UVevNp J3+RdSFaWoM9etrX9sEyPcrtvHeddXryVTCt5RNJGh3mRNA2z5a3aqXjlveZpIUcxFnq O6PV2jzrAHsN2MKJxE9tD/sYudvDDOv780+fUhAbF/YXLyUEZ/YJ2Z15pjMNMVCYNjeY LFNNXM5p3flivmp6QH7KM9N4QtskIDHS5p7rI7M1zFlTM0gkZ+MCjqwsNjYPXLbw6PUy R9rnhGVZaZu+1/hN1+rvx9mRQ8LSscAH7EAFux09gb5PfK52c4oZUjoZWyyScN0GuKNI sk7g== X-Received: by 10.70.49.35 with SMTP id r3mr3836373pdn.22.1429392944472; Sat, 18 Apr 2015 14:35:44 -0700 (PDT) Received: from [192.168.2.102] (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id i16sm13738087pbq.79.2015.04.18.14.35.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Apr 2015 14:35:43 -0700 (PDT) Message-ID: <5532CE2E.1040607@gmail.com> Date: Sat, 18 Apr 2015 14:35:42 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Alexander Moskalev , "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PR 1217: Add support for upload files from buffer string in curl extenion From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > I have few questions for my pull request: > https://github.com/php/php-src/pull/1217 > > Short story: in some special cases we need to upload just created small > file(s) by CURL. For example it's autogenerated image or pdf. And libcurl > give for us this options: CURLFORM_BUFFER, CURLFORM_BUFFERPTR and > CURLFORM_BUFFERLENGTH. My request about adding this options to curl php > extension. I wonder if it's be hard to make streams work there... Then you could just pass php://memory or data:// as the file. Not sure about security implications though, needs some thinking. > For basement I used class CURLFile, but can't find solution to use same > class, because this class require file name on disc parameter in > constructor. So I created new class, now it called as CURLBufferFile. While it does require file name as parameter, nobody says anything about disc there. So in addition to the above, you just could add setFileContents() API (or setFileBuffer? feel free to bikeshed :) that would make it take existing buffer instead of reading the file. > So, my questions are: > 1) Can we still integrate this functionality to exists class CURLFile? I think, yes. Or at least we should try to. The meaning of CURLFile is not "file on disk", it's "something to be fed to CURL to be uploaded as a file", so having buffer does not violate the semantics. > 3) What do you think about unserialization for this class? > a) Do not accept it (becouse object can contain very big file) > b) Accept I don't see big issue in serializing/unserializing it. Yes, it can be big. So can be any string you can pass to unserializer, any object can contain tons of data, nothing different here. This object is just container for its values, so I don't see anything special here. -- Stas Malyshev smalyshev@gmail.com