Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85870 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79744 invoked from network); 19 Apr 2015 15:41:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Apr 2015 15:41:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=kelerest123@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kelerest123@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.54 as permitted sender) X-PHP-List-Original-Sender: kelerest123@gmail.com X-Host-Fingerprint: 209.85.218.54 mail-oi0-f54.google.com Received: from [209.85.218.54] ([209.85.218.54:35502] helo=mail-oi0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/B1-57547-BACC3355 for ; Sun, 19 Apr 2015 11:41:31 -0400 Received: by oign205 with SMTP id n205so107607314oig.2 for ; Sun, 19 Apr 2015 08:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=hZrOajrMfjUMr7xiE944H7F4wT/jwYVQGTsI6NYJWLc=; b=XGmpAZJHQSnb6amm08uPV23s7xLi/E6cAaSqUmqaMO3FQnT3cFp0dGrBIB86Oh5l0B QRkT60iJ3dtSsuOEioRK7McC1RxueuzkjQGkiuD7HyO9XvY0rUsswBY0CX+X5pCfw4Pl Zy+JGFLKFDaq4p1dUmHf9SMRdY/aKRoCMn1E8AF31fA8hTDzYLxo4mNCeGtowFVZ7wwp nLd3tvm4M5jxPhFdJtZZUokbcpTEzcjQf+Gh7Da+9IpZ5tuXSrNxKhaWUFnNdPyyr7Et tXyA3l7U+H0mIQZUVzl8Qg05vr6uYBLw0KnoeTPmWb5eiNAMGh5Vwml9klPY5gZaqv+Q 4aIg== X-Received: by 10.202.77.11 with SMTP id a11mr10212437oib.101.1429458088811; Sun, 19 Apr 2015 08:41:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.213.135 with HTTP; Sun, 19 Apr 2015 08:41:08 -0700 (PDT) In-Reply-To: <5532CE2E.1040607@gmail.com> References: <5532CE2E.1040607@gmail.com> Date: Sun, 19 Apr 2015 17:41:08 +0200 Message-ID: To: Stanislav Malyshev Cc: Alexander Moskalev , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1134f14c9ae3b6051415a5b2 Subject: Re: [PHP-DEV] PR 1217: Add support for upload files from buffer string in curl extenion From: kelerest123@gmail.com (=?UTF-8?B?SmFrdWIgS3Viw63EjWVr?=) --001a1134f14c9ae3b6051415a5b2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable So, get directly to your questions: > > 1) Can we still integrate this functionality to existing class CURLFile? I think it would be possible, because like @smalyshev said, CURLFile represents symbolic file, that is going to be uploaded with CURL. So my suggestion would be creating a static factory method on this class, something like `CURLFile::createFromBuffer( string )` or `CURLFile::loadFromBuffer( string )`, which would create a CURLFile object and initialize it with the passed contents (=E2=80=9Ebuffer=E2=80=9C). 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 am for (un)serialization for this class. I think it's upon its user to think whether to use it or not (because it could be a benefit, but there are also situations, when it's not -- like that case, in which you have very large file buffer). Best reagards, Kubo2 2015-04-18 23:35 GMT+02:00 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 libcu= rl > > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1134f14c9ae3b6051415a5b2--