Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81871 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90675 invoked from network); 5 Feb 2015 08:17:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 08:17:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:49386] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/36-51979-32723D45 for ; Thu, 05 Feb 2015 03:17:39 -0500 Received: by mail-wi0-f176.google.com with SMTP id bs8so37147084wib.3 for ; Thu, 05 Feb 2015 00:17:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ZNni/dbixeqjmahi77UeG0Cm7U+pJElt5KACZyYjL6U=; b=zTXH+FtFC2hipeGeC2vH22jH+2YooC7dk6C5gQYVa6gH4/WWPqoWNo5e2BM1S5gfSC vXaCdzVgxSAQR4NFIlzbeEDRy5XGW+3Af3yjPjDBfLv0hI3Gl91lcEVFSzbziSummry6 8qbSqZ8XiAI70dagr3kK9ZLb1fU9bQ3YMgU/eT8CSAdWZ6J4aMf95Gh3RVL6h8mE9RCt BO0OaW5SMRu6FimqkIJMytX2JAPEUFe4GEUxBgLLRAlT7KNALs+QWsypIZGOQfyhVZW0 Cel/N2bc2kdhcXNEKdUX1dNXqMRj0MHx+81zjddX8R5zmE7sH4+EEhlPLuYJ3xHfsS1E e8lg== X-Received: by 10.194.108.9 with SMTP id hg9mr5335223wjb.68.1423124256150; Thu, 05 Feb 2015 00:17:36 -0800 (PST) Received: from [192.168.2.120] (89-104-28-113.customer.bnet.at. [89.104.28.113]) by mx.google.com with ESMTPSA id r8sm6709843wib.16.2015.02.05.00.17.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 00:17:35 -0800 (PST) Sender: Michael Wallner Message-ID: <54D3271E.2080207@php.net> Date: Thu, 05 Feb 2015 09:17:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Stanislav Malyshev , PHP Internals References: <54D217E7.8030407@php.net> <54D2AE91.8090800@gmail.com> In-Reply-To: <54D2AE91.8090800@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: [RFC] [DISCUSSION] pecl_http From: mike@php.net (Michael Wallner) Hi Stas! On 05/02/15 00:43, Stanislav Malyshev wrote: > Hi! > >> Points explicitely marked for discussion in the RFC itself: >> >> * pecl/propro >> Proxies for properties representing state in internal C structs >> https://wiki.php.net/rfc/pecl_http#peclpropro >> >> * pecl/raphf >> (Persistent) handle management within objects instead of resources >> https://wiki.php.net/rfc/pecl_http#peclraphf >> Also, take special note of the INI setting: >> https://wiki.php.net/rfc/pecl_http#raphf_ini_setting > > I'm still not sure why we need these two, to be frank. E.g., for the > former I can kind of get it, though I don't see any use-case that really > requires going to such lengths, for the latter I'm not even sure what > the case for that is - i.e., why exactly would one need persistent HTTP > connections surviving the request? Uh, for me it's actually the reverse :) While propro is nice to have, I think raphf is far more of practical use. Why should HTTP, or even more HTTPS or HTTP2, be any different than another service, especially when HTTP APIs are so common nowadays. Compare the timings accessing google 20 times sequentually: With default of raphf.persistent_handle.limit=-1 (unlimited): █ mike@smugmug:~$ time php -r 'for ($i=0;$i<20;++$i) {(new http\Client("curl","google"))->enqueue(new http\Client\Request("GET", "http://www.google.at/"))->send();}' 0.03s user 0.01s system 2% cpu 1.530 total With raphf effectively disabled: █ mike@smugmug:~$ time php -d raphf.persistent_handle.limit=0 -r 'for ($i=0;$i<20;++$i) {(new http\Client("curl","google"))->enqueue(new http\Client\Request("GET", "http://www.google.at/"))->send();}' 0.04s user 0.01s system 1% cpu 2.790 total > >> >> * POST parsing disregarding request method, solely based on content-type >> https://wiki.php.net/rfc/pecl_http#rinit > > I'm not sure what exactly happens there. Is _POST in the RFC code > populated for every kind of request automatically? That may be > unexpected, though the ability to parse incoming data as POST regardless > of method may be useful. But it'd help to have a description of what > exactly changes. The sole code change would be removing the check for POST, i.e. `!strcasecmp(SG(request_method),"POST")` so that actually any request method with a recognized content-type (i.e. application/form-data or application/x-www-form-urlencoded) would trigger standard post data handling. The RINIT of the http_env module would be removed in any way, because if this behaviour is accepted, it's accompplished by the change described above, and if not it makes no sense to keep for an extension bundled with the core and maybe enabled by default. -- Regards, Mike