Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114002 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17489 invoked from network); 8 Apr 2021 14:47:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Apr 2021 14:47:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 986E51804CC for ; Thu, 8 Apr 2021 07:47:09 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 8 Apr 2021 07:47:08 -0700 (PDT) Received: from myt5-f0b85eae3a0b.qloud-c.yandex.net (myt5-f0b85eae3a0b.qloud-c.yandex.net [IPv6:2a02:6b8:c12:5a2c:0:640:f0b8:5eae]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 0FFE33280C5B for ; Thu, 8 Apr 2021 17:47:06 +0300 (MSK) Received: from myt5-ca5ec8faf378.qloud-c.yandex.net (myt5-ca5ec8faf378.qloud-c.yandex.net [2a02:6b8:c12:2514:0:640:ca5e:c8fa]) by myt5-f0b85eae3a0b.qloud-c.yandex.net (mxback/Yandex) with ESMTP id LDAUtG2XEe-l5IqqV2W; Thu, 08 Apr 2021 17:47:06 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=php.watch; s=mail; t=1617893226; bh=Nti76G8PaNBvl86VNoAMlNUvniP4ax8gWolf8hDz32A=; h=To:Subject:From:In-Reply-To:Cc:Message-ID:Date:References; b=EemkPs4PCsK6J7Z/50Ufb/Q+O/h84S2y0cHMyURT+Q2QF9CuJkBANo0lBXk6lZLFC y4GFXRA32ZvJABbp0KhN1EoxIJuGWQwuNWetgFq1EEkOWoVxhbHbjiGBjGGbPmyaHD NhV4oZINLneidLmfsbadmu4ReNPeZwh6I/kn2dWo= Authentication-Results: myt5-f0b85eae3a0b.qloud-c.yandex.net; dkim=pass header.i=@php.watch Received: by myt5-ca5ec8faf378.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id dxSvv3u5EC-l5KmobZG; Thu, 08 Apr 2021 17:47:05 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Received: by mail-oi1-f181.google.com with SMTP id x207so2439612oif.1 for ; Thu, 08 Apr 2021 07:47:04 -0700 (PDT) X-Gm-Message-State: AOAM532Br0s00rvtOFFDTfeb+35jrwGGVj4ngHDigptwSK4L8w+AlZpe 30L1Q+fhZb/TdYKvzFpnIl/Iuini8hHj2zSJsWg= X-Google-Smtp-Source: ABdhPJyIfc1lh7wMyL4/iFz5J6/Oqba8kfb5rQ7yFhFjdYZTno0IMXKbpWlYqyo60wRl/hgQBTu6ibAyyU1r+iCELtk= X-Received: by 2002:aca:7543:: with SMTP id q64mr6374449oic.100.1617893223843; Thu, 08 Apr 2021 07:47:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 8 Apr 2021 20:16:37 +0530 X-Gmail-Original-Message-ID: Message-ID: To: Michael Maroszek Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] add php.ini entry to set default user_agent for curl From: ayesh@php.watch (Ayesh Karunaratne) Hi Michael, Thanks for opening this conversation and the PR. Most HTTP client libraries that need to set a custom user agent do so with `curl_setopt` because it needs to contain a library version or some sort of dynamic values. They will likely not benefit from this change. On the other hand, libraries that do not bother to set a UA string probably wanted it that way too, because Curl's default UA string is useful as it contains the Curl version. That said, if it comes to it that we add this feature, I'd be in favor of a new `curl.user_agent` as opposed to inheriting the global `user_agent` because that would be BC break. We already have `curl.cainfo` INI setting, and adding a new `curl.user_agent` wouldn't be a drastic change to configuration either. -- Ayesh. > > Dear Internals, > I'd like to suggest a new enhancement for 8.1 as outlined in the title. > > The initial pull request is here: > https://github.com/php/php-src/pull/6834/files > > --- Details: > Since quite a while PHP offers a dedicated user_agent php.ini entry, but it > affects only all internal implementations like file_get_contents. cURL has > no default and you need to modify CURLOPT_USERAGENT in the code and for the > SoapClient there is a parameter 'user-agent' in the constructor which can > be set. > > Therefore I'd like to introduce an equal entry for curl.user_agent which > would set a default user_agent when making curl requests. Of course you can > override it with CURLOPT_USERAGENT if required. (I can implement the same > for SoapClient, if requested) > > --- Alternative: > I could also use the default user_agent entry, but I wasn't sure what the > best practise is and went for the more "local" approach for the initial > implementation. > > --- Bigger picture: > When the preferred solution is to use the default user_agent, we could also > try to determine more places where i could send the default user_agent to > give this php.ini entry a more consistent feeling. > > Thanks for your consideration, > Michael > > PS: Subscribing to the list through https://www.php.net/mailing-lists.php is > not possible and quits with the following error: We were unable to > subscribe you due to some technical problems. Please try again later.