"Peder O. Klingenberg" <peder@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 61916) by debbugs.gnu.org; 18 Jul 2025 12:58:23 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 18 08:58:23 2025 Received: from localhost ([127.0.0.1]:33213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uckfP-00056x-1w for submit <at> debbugs.gnu.org; Fri, 18 Jul 2025 08:58:23 -0400 Received: from s17612523434.blix.com ([176.125.234.34]:44116 helo=castor.klingenberg.no) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <peder@HIDDEN>) id 1uckfI-00056M-32; Fri, 18 Jul 2025 08:58:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=klingenberg.no; s=20200407; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Svb4xtra7UMrJBAuI+TpkFA+SvJjluTVIbEikna/oZw=; b=h5Cz0c/4ntSbmO3PfRO2SkISZ VZaZZUSFT8VsyccXylvrmp4+Jo4V1hajdZiqoe0sopqYVmCFOgh8TvhQGMDF1k0hcqIYLJmnOjTgp DQ15eidcS51CuSW2jeFgE/LWGylZsR3Ch1cGiAT3th7Dsejqe9bErN8TzbM1KebTs5oaL/zJ9jYhW l3RHhnf6O5Qjdu+QJQEBwG6JaIp+Qgcng89ZtPU+ZuXyqZFAZwIaJhB/uLRdlwKdjHMLYkrLFig/P U2LrtPnsrYAk6knDo3oRlh0BNOlGUp0TZOZ/XCXT9Q9xA0jjZrgxJJ1ymjFYp1HrwnmM+3YX1dSl/ kDaMbbb7Q==; Received: from 77.16.47.234.tmi.telenormobil.no ([77.16.47.234] helo=PedersHP) by castor.klingenberg.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <peder@HIDDEN>) id 1uckfE-0008UJ-TD; Fri, 18 Jul 2025 14:58:13 +0200 From: "Peder O. Klingenberg" <peder@HIDDEN> To: xhcoding <xhcoding@HIDDEN> Subject: Re: bug#61916: 30.0.50; url.el; Can not change User-Agent temporarily when url-retrieve In-Reply-To: <tencent_A0A5AD1C38105A58F940023C9D24154A0A07@HIDDEN> References: <tencent_A0A5AD1C38105A58F940023C9D24154A0A07@HIDDEN> Date: Fri, 18 Jul 2025 14:57:58 +0200 Message-ID: <87ecudlkq1.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61916 Cc: 61916 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) tags 61916 + patch quit On Thu, 2023-03-02 21:37:13 +0800, xhcoding wrote: > The following code cannot be used to temporarily change User-Agent > > (require 'url) > (setq url-debug t) > (let ((url-user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.57")) > (url-retrieve "https://httpbin.org/get?a=b" (lambda (_)))) Some, but not all, variables used to construct a request by url-http.el have their dynamic values preserved in the buffer used for the async communication. url-user-agent was not among the so blessed. For the unlucky variables, the behaviour is extra confusing because connections are sometimes re-used (due to http keep-alive), in which case the dynamic bindings _do_ work as expected. This same issue hit me as I was working on improving restclient.el, where some of the bug reports probably originate from this confusing behaviour of url-http.el. Attached is a patch that extends the set of dynamic-values-at-call-time -> buffer-local-available-at-request-time variables. With this, your test case works as expected, as do my experiments in restclient. Hopefully this will be picked up by someone with commit privileges. -- ...Peder...
bug-gnu-emacs@HIDDEN
:bug#61916
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 2 Mar 2023 14:45:27 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 09:45:27 2023 Received: from localhost ([127.0.0.1]:56252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1pXkBN-0006PY-J2 for submit <at> debbugs.gnu.org; Thu, 02 Mar 2023 09:45:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:40012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <xhcoding@HIDDEN>) id 1pXj7k-0004dx-9i for submit <at> debbugs.gnu.org; Thu, 02 Mar 2023 08:37:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <xhcoding@HIDDEN>) id 1pXj7j-00021B-TR for bug-gnu-emacs@HIDDEN; Thu, 02 Mar 2023 08:37:31 -0500 Received: from out162-62-57-137.mail.qq.com ([162.62.57.137]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <xhcoding@HIDDEN>) id 1pXj7g-0001wk-PP for bug-gnu-emacs@HIDDEN; Thu, 02 Mar 2023 08:37:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1677764235; bh=Z1VnxUR2Jq6tHtviFRmVilQHPOy8toREQzGcfpfILoQ=; h=Date:From:To:Subject; b=oT9/KViHtvUu9sVRw1Q4EI1EAb4ZpX4XxCZd4TXYHiAvBy1MB2Lbhy+4FK1RuO0jq QrKyCs9zScipoPXAtztFHXsSqBQSoqmQpOdlJQ7ZEOzyGWfU+7HMt1DuPF0Wo0jw/f AZjxXJzJkXbw/K66XDUHtACXmpN6J9wvkFGGGFjE= Received: from XHCODING-PC.qq.com ([39.128.4.18]) by newxmesmtplogicsvrszc2-1.qq.com (NewEsmtp) with SMTP id 94E2AA4A; Thu, 02 Mar 2023 21:37:14 +0800 X-QQ-mid: xmsmtpt1677764234t4culun8z Message-ID: <tencent_A0A5AD1C38105A58F940023C9D24154A0A07@HIDDEN> X-QQ-XMAILINFO: OZsapEVPoiO6zwOjxU4FrQ5VBuutJBfG9xLob4sFQxM9ED7ff92Yd0Vsl+9FA7 MDeeWC0vt+kV9PFRFn2KdB/pmh+jZxgiZulMp24D1djRCEFF2qssfD2JOVP/WbqheoWdEjptPmUJ EwFfdMkLW9azcccaL/EEQkXiMLKpbvtYh6at8eiTfYJ7YYowGpjMayWQBHtVVjKu57CmTcZVgt15 C4equ/cgNw9W8iYrr1FzZ/0LdRBnAFkr/zgOJ+1TguFtsKRxmAuTyMN3pgcD9wxIOOONpX3NLV/g jGR0bQjAxHlNgVgzLokBM2Kb0XRdkL05GqJmaCjpabr28oeqLjy5m7xsbx0CP9X2M5jQuiB+lamz D7zjoib283EqJ8PG2VgTXrel2FtziXR7ixCskoP/kBQBCLCCdwoehlLEXD4CEHPm9/2F31Xpd/ys QkVjEp5BGgxcsgwC/RBKzkhrt+RAXKNc/I+DekaL+B6aMys0RossxaWhC5+6vETu7HPWjQmQkbR0 ih7fhD0WXRxuQ3UecAWOSXZQmEtp0vhqJmZBMb00PG689ZtzWByqKG6UHruRBhYRl2pcY1TYzTXO K5PelrJxPMoey+WLuuYgbZwsJ+0ChY2oQWF12giXw5P3nOcwBizdRpKCAySiKv9HsNQh1Rkhnn+4 nZCX8iRRq73/sAZ+093P0YTcIfIxT+BgEc3GGfd4iZ/5+N14ZvCq/RqsRckKXFDNOnh+at3vdgBw 1hAp2udqkI0TRhYasTQ/OA7pR6MeDktneb/ynyavTmCO3/KKJYTtxnpSQCLTe72QZZP27600x7nv 0N/wP3jz1kw6SkP2Edfk0xnR26KSE6WACy6OnjbCZhsytgQ/5uCshMlQ8UCrJDJh1ddkBEFRoW7T lkizI1YrZoTxJ0Wx67tLxJfEFCI/D92U0QBybFFRAW/2Qa76N2DgblQ9KqWB9nOqOBdLQ04fP+eO SIpVhRP407QqmtWpvH4VSfE3kO63XZ Date: Thu, 02 Mar 2023 21:37:13 +0800 X-OQ-MSGID: <86zg8vw9yu.wl-xhcoding@HIDDEN> From: xhcoding <xhcoding@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 30.0.50; url.el; Can not change User-Agent temporarily when url-retrieve User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-w64-mingw32) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Received-SPF: pass client-ip=162.62.57.137; envelope-from=xhcoding@HIDDEN; helo=out162-62-57-137.mail.qq.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HELO_DYNAMIC_IPADDR=1.951, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 02 Mar 2023 09:45:19 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) The following code cannot be used to temporarily change User-Agent (require 'url) (setq url-debug t) (let ((url-user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.57")) (url-retrieve "https://httpbin.org/get?a=b" (lambda (_)))) Because the url-retrieve is asynchronous, when the url-user-agent is actually used (eg. url-http-create-request be called), it may be out of the let scope. In GNU Emacs 30.0.50 (build 5, x86_64-w64-mingw32) Repository revision: 07a76a06f9a438e2a1bf1e565e3e78f7927c37f2 Repository branch: master Windowing system distributor 'Microsoft Corp.', version 10.0.22621 System Description: Microsoft Windows 10 Home China (v10.0.2009.22621.1105) Configured using: 'configure --prefix=/d/emacs-build/pkg/master-x86_64 'CFLAGS=-Ofast -fno-finite-math-only -fomit-frame-pointer' --with-zlib --with-xpm --with-xml2 --with-tree-sitter --without-tiff --with-rsvg --with-png --with-lcms2 --with-json --with-jpeg --with-harfbuzz --with-gnutls --with-gif --without-cairo --disable-build-details --without-dbus --with-compress-install --with-small-ja-dic' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB Important settings: value of $LANG: CHS locale-coding-system: cp936 Major mode: ELisp/d
xhcoding <xhcoding@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#61916
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.