Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114039 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13809 invoked from network); 12 Apr 2021 15:01:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Apr 2021 15:01:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 44C3B1804F3 for ; Mon, 12 Apr 2021 08:02:32 -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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 12 Apr 2021 08:02:31 -0700 (PDT) Received: by mail-lf1-f44.google.com with SMTP id z13so4849620lfd.9 for ; Mon, 12 Apr 2021 08:02:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eP3UpjPPdxiR3i4bZ0aEuYSNV50axUYqZa52BQ3+agM=; b=fRcznblcly0NsJBP50rOr8oyVakHV6Ng8d9nzh0+TWmS8nhOS5XmbA8tsP1bxpRLig g56Cdpc+fhuBTDNTaNLIpseIo9YIRob1wul0UIELr4gxtUC4HwsgR7eeDifBUtvgqxgo 3Z8e55rDwkpTJVT/J9N09N4CUGkTfAszpvSD0BVYTs15vDwMrQYns0fhhYVorNMSaahE loAcTl9mSd/V/hcx9Eyvj45fSzz70iZRI0fMeEBu7xoCL4RdpaBmWudxPZd7f0urc7aK BEaLsiFEt/lZMJsrGtoGYLv7aGwb9hmbVurgJrP2jg5pZ0x3vvtfxX8qNhUgJw6jOHRp +oDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eP3UpjPPdxiR3i4bZ0aEuYSNV50axUYqZa52BQ3+agM=; b=QOGhFYXqxpIg3zVxAnMbMPgzoVp2a7YyPDu1sVurBw11qMRVAITCmVumH6Xzg+i+SQ lKgreyvxeAcr7s6CWXuFNn1UiCSB2jgdzevqCnbay71e8xiT//KzWLYoJ09DrHgEzi78 doEy5UzaufEf8/2VkvaqQxxDKwWCd5xBeqWwJ59vRzMxcBF0C4W6eJ+FAbeaJ8CWffvW 95CKGvwDCaQP0hVYh17Kl7nF804LgagIqFyCQY/1itIXQhx31HXK7pAmII7hEqSL/Mwe cFakXX4ihEYWsHTC0OLkug5MXgcK7EaF+OAUxU4Eamplb/HSfml4ubMhcsyXflOyPS0a yjwQ== X-Gm-Message-State: AOAM530NVRctbDrMAwd1Qj0DYC4rToveGoZqYwlAuWsQ3NO3O1Rpzfff jYvbxUpAHMlZd87ZRjTFsHNBM5L63mXJOM8nLkc= X-Google-Smtp-Source: ABdhPJwVo7k8oK83XpSCQDYjRNVNZaq9rl65mEXM8v4n3QR0MkBYb7u3bmNmhdyGdHWILU9FZ2PdqXZSXVquZcj4sVI= X-Received: by 2002:a05:6512:3991:: with SMTP id j17mr18920412lfu.315.1618239750072; Mon, 12 Apr 2021 08:02:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 12 Apr 2021 17:02:13 +0200 Message-ID: To: Michael Maroszek Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000076ef8905bfc7cd01" Subject: Re: [PHP-DEV] add php.ini entry to set default user_agent for curl From: nikita.ppv@gmail.com (Nikita Popov) --00000000000076ef8905bfc7cd01 Content-Type: text/plain; charset="UTF-8" On Thu, Apr 8, 2021 at 2:41 PM Michael Maroszek wrote: > 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 > Could you please describe what your use case for this change is? I'm generally not a fan of adding more ini settings (aka global state) without a strong motivation, and it's not immediately obvious what that motivation is in this case. This seems useful if you have both a) one user agent you want to use for everything and b) a lot of heterogeneous code that doesn't use any common abstraction, which seems like a rather odd situation to be in. Regards, Nikita --00000000000076ef8905bfc7cd01--