Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128163 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id A250A1A00BC for ; Mon, 21 Jul 2025 15:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753110953; bh=Kd9V2kbZBdf8C3uKZF+ieFP3u1rN4Sf01ZHvAoHp9iU=; h=References:In-Reply-To:Reply-To:From:Date:Subject:Cc:From; b=VoqvfCsmEA9l84AjBPw7r3/m3Pv+q4TtAFpexK9qZMpuRDMeoTk3geyBBQn8Fr/JS amCKdKVKbP4xN+RREzA1yfr7F/ntyiqeoq6R9MWrMX93HgUF1aoA0tfF64/waWooYD Y+DyDcA1tDe4DgB8SAIEfwIT3VWtHAchdO1x/uVYKK+25hG71vjiMJ7lZ3i40Wpt61 hF/XovO6FPGWDUcl9tzhbPLCPO99O/ki7RbtdcoWTo2qvH2ALhjYGUxnmL8oKm40LD RSsKfbGatd03wzfofngAU9PDnFP8an2K7AwK05yryRmYZe72diGAmCY4LTU2Qzidoz 9/AxuySrbEUrA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 217111801EA for ; Mon, 21 Jul 2025 15:15:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: ** X-Spam-Status: No, score=2.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, FREEMAIL_REPLYTO,MALFORMED_FREEMAIL,MISSING_HEADERS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 21 Jul 2025 15:15:52 +0000 (UTC) Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-87999c368e9so432866739f.0 for ; Mon, 21 Jul 2025 08:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753111058; x=1753715858; darn=lists.php.net; h=content-transfer-encoding:cc:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Kd9V2kbZBdf8C3uKZF+ieFP3u1rN4Sf01ZHvAoHp9iU=; b=EohAxtkshOAllIrskxDLm8rJURxo56IrYuRjGsgDG9LQNx9LqEMOr0hgYvV2c2+kqT 1fdFBIe4neLT7kOKwwq8+pqd3LfwlglqMuYkIFa9nmbtmk0jGRnyB7xUTOaaK9zNNXVQ smSaWjJsYZNe4neDE9UvEugPjY4ikX2zwaP6wiZZz5TUMCf8zyBx3r5byS4P7AGR2zEz HkEvBMsYt1AbQ7Dvvi9df5iE0Ey+BrIYSpT5P5bh7QjdO6luSUE+tffA+qz9byXmE8Pm Lcd2OfknOOarkq/DRcPBmPPkqvpVvKaOKb0XkGOFNXzdouBmLPVfFSQFyihXWcGRO3x0 VUFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753111058; x=1753715858; h=content-transfer-encoding:cc:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kd9V2kbZBdf8C3uKZF+ieFP3u1rN4Sf01ZHvAoHp9iU=; b=ZlRu8N2DQidfojiXce50sgKHva+B6mdaWGhjhwC6j3Mkcgk5Gbw84wtp4CpHMG7CBa 5JqSZCW2ZUQ6eCO7FaKIYuTqQfIpRk9ecVoaWTJIpg9V8FrfsIzos2a6Z59u0H4rrP+A +f0nbtfi5aVL/bj8Y5X/T+MZSx5NaNyP54V1fiuTJekkaCT/d14jMWB5VXotXkaWnn+P o3U2qxOEVvns3+29oe93W/Xa37vsUsUcMddZvnEfRRwBeU9gS6E6GDHPuyRZXPt9vR0D PqkEfQlZCcT0YKr7bL/6oTeGAZr9kBLLA0w+MD4eQYUJZCMGcMISb2sPfP6hAXKEE+wu 1saw== X-Gm-Message-State: AOJu0YyvdMYzRlRVqgeEqDaE8xr+MCrV5EBmLxLt8fcwlLQOUsfunkF4 NB58SIpTzuOxC0ysK6pW1LxqCqKAskbicm4lmAVAMU/BHyNXC4Pwqj6Er7lO9i8Z47IHvwStnIs OrWy/Y8dAcEwjarAfBcI4ROReHGzMIsdgEg== X-Gm-Gg: ASbGnctkus9p6bVvN08abJvpBkDoAbL/3OGfN3ZtT6FGP1m5Q5SbOT42K5JCdnafQ54 2vbU/6DRpxiHOeLkjCQx/OgJKPtsvgRypgtvm8Pe03tl7wq1vESVgGTiD8P9G5O6qwMGUeOcg2C pa7QEu6G2MGKCzGrbqoYFRSu9vvXF9OhX6QtIisIPYfdEoEfDBs7STiXctMsk3U8xjI3dPziIPI wnwsUk6svd7hAZrlgQkYdjeMfP3arRxOYdceumrCg== X-Google-Smtp-Source: AGHT+IFkZa230n2Tx7z6HhpSXlN/QTuCy4VijAzV1TLY9m7j7Tm7pE5d63kJ4ssgOJ3BZT56Jcw6xMsnf2lOzswEN30= X-Received: by 2002:a05:6e02:3c86:b0:3e2:a366:c125 with SMTP id e9e14a558f8ab-3e2a366c42bmr127261955ab.18.1753111055916; Mon, 21 Jul 2025 08:17:35 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Reply-To: erictnorris@gmail.com Date: Mon, 21 Jul 2025 11:17:19 -0400 X-Gm-Features: Ac12FXxxsRnqyB7xXMCv2f7NHcWRsdIlvbGWfbr2sWCiAwV58LEyhCaJ0Rizgbg Message-ID: Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object-oriented curl API v2 Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: eric.t.norris@gmail.com (Eric Norris) On Mon, Jul 21, 2025 at 10:47=E2=80=AFAM Eric Norris wrote: > > On Mon, Jul 7, 2025 at 12:53=E2=80=AFPM Eric Norris wrote: > > > > On Wed, Jul 2, 2025 at 11:48=E2=80=AFAM Eric Norris wrote: > > > > > > > Based on the feedback so far (I do plan on waiting for more respons= es > > > > to your email), and on my own preferences, I wonder if there is a > > > > hybrid option I could propose. Perhaps the RFC could offer both a > > > > \Curl\Handle (tentative name) to address position 1, and a > > > > \Curl\BasicHttpHandle (also tentative name) that addresses position= 2? > > > > If people were amenable, I'd even make the BasicHttpHandle a separa= te > > > > vote. > > > > > > > > I agree that 3 is both more bikesheddable and also possibly ideal, = but > > > > I feel my above suggestion maybe strikes the right balance between = the > > > > "status quo is fine, I don't want to see random HTTP-related method= s > > > > on my low(est)-level curl object" and the "I'd like to do basic HTT= P > > > > stuff with curl, without a library" crowds. > > > > > > > > Barring that, my preference would be 2, but I'd accept 1 just to ha= ve > > > > it pass - like I mentioned elsewhere, I think there is value in > > > > introducing namespaces and object-oriented APIs for "modernization" > > > > and language consistency reasons. > > > > > > Having thought about this some more, while I'm still feeling somewhat > > > positive about my suggestion I'm just not sure it's the best way to > > > proceed. I started to sketch what a BasicHttpHandle class would look > > > like, and I'm stuck on how to get data about the response out of the > > > class. > > > > > > Naively, we could have $response_status_code and $response_headers > > > properties, and have the same fetch() and execute() methods I > > > suggested elsewhere to get the response body. Alternatively, we could > > > return a simple CurlHttpResponse object which contains all three > > > properties in the fetch() and execute() implementations for the > > > BasicHttpHandle class. > > > > > > Both of these are fine, but they would lock us out of being PSR7 > > > compatible. I think that people would probably desire PSR7 > > > compatibility, and I would feel uncomfortable with eliminating or > > > tainting the possibility of achieving this. For example, if we had > > > this BasicHttpHandle and then later introduced PSR7 response objects, > > > we'd need to either break backwards compatibility for the class, or > > > introduce a second class. We could also go straight to returning a > > > PSR7 compatible response for the BasicHttpHandle class, but I think > > > that likely deserves its own RFC. > > > > > > So in closing, if people felt generally okay with the limitation of > > > not being PSR7 compatible, I'd probably still add some form of my > > > BasicHttpHandle suggestion as a secondary vote. If people thought PSR= 7 > > > was necessary, I'd drop it, and leave a PSR7-in-core RFC for the > > > future. In that case, I'd go with Larry's option 1 for the RFC; I've > > > currently updated the RFC to match that option for now. > > > > Thanks Ben, Larry, and Paul for your responses to my suggestion for a > > BasicHttpHandle class. After reflecting further, I have decided to > > move this to the Future Scope section, as it feels weighty enough to > > stand as its own RFC. I'd like to think about this a bit more, but I > > will note that having a Request and Response interface in core would > > greatly simplify the proposal for a simple curl-based HTTP client, so > > I'd likely support any effort on that front. > > > > I've also updated the Curl\MultiHandle class proposal to account for > > removing the CURLOPT_RETURNTRANSFER option. > > > > At this point I believe the RFC is in a semi-final state at this > > point, barring any additional discussion. Thanks all for the feedback > > so far! > > I'd like to bring this to a vote since discussion has died down, but I > feel that I should implement the proposal before doing so. As always > this is the hard part, and since I'm back from an extended break at > work I will have less time to focus on this. > > I've mentioned this before, but if anyone would like to collaborate on > the implementation, please reach out! Otherwise, I'll update this > thread with a link to the implementation at some point in the future, > give it a little more time for discussion, and bring the proposal to a > vote. Apologies, quick clarification: I do not intend to target PHP 8.5, and will update the RFC to note this.