Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127838 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 6C4A81A00BC for ; Wed, 2 Jul 2025 15:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751471875; bh=/mP9cQYxo1F12uAmbzoqCAQe6lNyEWuQ4n6egHelnd8=; h=From:Subject:Date:References:To:In-Reply-To:From; b=MnNIuPP8m8ufM76USYeaJ9XVpAx3mf60jK/4D29S3Ilo7vS13Ac4bHpXeWOCdw6Wk CmjhIITjM/NjfKLJUTnVJi084o/4C4hXhTQk5qP26qZHI/GEXu+vtLFZDmjZ9rxycj jj5yYNwDr4yFCGWNz9iu22MnvQcojMztaMAmSJwNr2Suuh6DpB3aY3prPSG24s9Zky 8pIsdTs/yUkpOyxSynYAt3Fvsm7wzebaAQjYpBv/KHNRz2g/vI9duAqcLI30SjrQkX Jr/oP+YJtHEdtdKMpju+AdmZF0SgI91X1SC6Gw/IQt2+I2Y/f8OvaOq2OgLbN3kLuw smE9M0D7qNt+Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9A078180054 for ; Wed, 2 Jul 2025 15:57:54 +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=1.7 required=5.0 tests=BAYES_50,DMARC_NONE, HEADER_FROM_DIFFERENT_DOMAINS,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-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (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 ; Wed, 2 Jul 2025 15:57:54 +0000 (UTC) Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-e812fc35985so5608193276.0 for ; Wed, 02 Jul 2025 08:59:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751471986; x=1752076786; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ic3eYZxrpUaLdMot7vamjtCN4OD4kNHFr/84qBfKTqk=; b=nE4PfehnU1PSRRiHeho+CmpatZ275zesxAbkp6PTUTsXsXzG3B4nCui/Pg7YXid4s1 AeMEdxDvr5ps/KIlB5ECCAS+iKb4JvU2VJeEBxsZbISMCY5aaPfTQJLxkaogZmRd+TMX 6DIB/nd6Ac4KGTPy7zyHvfQ1zXU64TaIiQJWGtkwAfxDi/y5HIJhM8LNoh/XrMLFDFn8 JtW0lyVEPMeYCQwr/v2OhrvNWmGy1wt+oUBcKzUskKhInfNST+28ENxhPYtwqZWTAqHX cvNDdH0aq6kA/kR0jWzT4AiEeFAY+pqPwNPBFc35PJAhTQZaqzr4hytGL33QIRYGSsAP Q2Jg== X-Gm-Message-State: AOJu0Yx7LWOnoi/1NyyH5tjprgl0VB9/JwY4ebexRpH/w04pJ8U1CwVc RgVTeBVoyW+IZSm1jYCYZhxsjV9gNycoi6ywuTVhPkSLkaNOIX+gzgtlQza/I7AaYKrRa3ClgZT lvz6tXg== X-Gm-Gg: ASbGnctRtLi539FuhxF8OCOu4O2D5xbjapSoCkWOa+wyvWJOprsuA3Fz31tOwLwRsgN rhJ0GSpsseeP36e6CB0Y6nJkY/vXi43KOT+lE1tbF6p59sbaRFmVaZwPm5Y0beuPZE5evrr2djj A2/gqGtqM5+mbvlPjqH+Itp0Zx7qFJfi1VLxQqBjmwCIAI62u6GaYz0wu3ybPZ43gNMVYN7i/yc AGXwLwzdx/LFkDSJ/LR2dai/+VVq2QO3IcgqsB5D9HPt5kPwXd7fk3aJ7RsaxMSjJcE8YjS3KBG hOd/8Rhvcs8NvlirIA22hebx9u/+oWaTbbm9FNKpqe2A1BY39J/1HWdrAW1lE9p5lOVRIPEQPbC vGLSDWy0U6ul1wSVj1WV+XS0ElhlncWkSV1caI4DyjrRtYAQMa6vnhzTLI6rq X-Google-Smtp-Source: AGHT+IGx4F0OMjiN4CAjhGo2cPCjKg6g/oRk78m/8LopwgZf7YImWiKNBEoTaCDAsaLy7eg6ai0J5g== X-Received: by 2002:a05:690c:6213:b0:70c:bd93:4519 with SMTP id 00721157ae682-7164d4d0a98mr45070177b3.21.1751471985565; Wed, 02 Jul 2025 08:59:45 -0700 (PDT) Received: from smtpclient.apple (h96-61-170-179.lvrgtn.broadband.dynamic.tds.net. [96.61.170.179]) by smtp.gmail.com with ESMTPSA id 00721157ae682-71515cc7f91sm25034397b3.117.2025.07.02.08.59.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Jul 2025 08:59:44 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_0411E513-FEAC-4501-A3CB-5352657AD5F7"; protocol="application/pgp-signature"; micalg=pgp-sha256 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object-oriented curl API v2 Date: Wed, 2 Jul 2025 10:59:33 -0500 References: To: php internals In-Reply-To: Message-ID: X-Mailer: Apple Mail (2.3826.600.51.1.1) From: ramsey@php.net (Ben Ramsey) --Apple-Mail=_0411E513-FEAC-4501-A3CB-5352657AD5F7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 2, 2025, at 10:48, Eric Norris wrote: >=20 >> Based on the feedback so far (I do plan on waiting for more responses >> 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 separate >> vote. >>=20 >> 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 methods >> on my low(est)-level curl object" and the "I'd like to do basic HTTP >> stuff with curl, without a library" crowds. >>=20 >> Barring that, my preference would be 2, but I'd accept 1 just to have >> it pass - like I mentioned elsewhere, I think there is value in >> introducing namespaces and object-oriented APIs for "modernization" >> and language consistency reasons. >=20 > 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. >=20 > 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. >=20 > 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. >=20 > 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 PSR7 > 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. I think it=E2=80=99s good to keep PSR-7 in mind when designing the = interface, but I don=E2=80=99t think it=E2=80=99s necessary to strive = for 100% compatibility. Userland will end up writing wrappers for it = that implement PSR-7. IMO, the interface should attempt to more closely = follow curl nomenclature and idioms, since it=E2=80=99s an interface for = interacting with curl. Cheers, Ben --Apple-Mail=_0411E513-FEAC-4501-A3CB-5352657AD5F7 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCaGVXZQAKCRCwLZeYnIwH G/OnAPwKgqPewksdKd6dAItVHXrfszAbay328cQIhCyPtb1V6wD+JmfljQv8529C TP8uwbTFKNl2NfruLsm7NB444Zc7T84= =1zGu -----END PGP SIGNATURE----- --Apple-Mail=_0411E513-FEAC-4501-A3CB-5352657AD5F7--