From unknown Fri Aug 15 18:12:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79186: 31.0.50; Make dynamic binding of url-max-redirections work Resent-From: "Peder O. Klingenberg" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Aug 2025 20:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 79186 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 79186@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.175451340512505 (code B ref -1); Wed, 06 Aug 2025 20:51:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Aug 2025 20:50:05 +0000 Received: from localhost ([127.0.0.1]:60439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ujl5J-0003FR-4C for submit@debbugs.gnu.org; Wed, 06 Aug 2025 16:50:05 -0400 Received: from lists.gnu.org ([2001:470:142::17]:36494) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ujl5G-0003Ds-Hp for submit@debbugs.gnu.org; Wed, 06 Aug 2025 16:50:03 -0400 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 ) id 1ujl57-0006n4-BS for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2025 16:49:53 -0400 Received: from s17612523434.blix.com ([176.125.234.34] helo=castor.klingenberg.no) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ujl53-0004TA-5A for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2025 16:49:51 -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: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uARor1cWRXGj4bH/TcGiTsFFyEHesr00o8UEvmPD1DQ=; b=VW3mWhq6TQV+xVhBQmlXG1luWB nOUuRnz9eI4DiJXmW7X4KrGtHj9HoZRI+U9kjdjHHFKxcr3j2/w9q5Wpmu+aJy/0a2T8JpElS6gDF B46ufskB3e0iatOZgT1ju7wT1Qo69lP49iast0wsZQR5gq3v+0Fu5KUIS3tgfFYrDHOlDjMGY+TEB GvlTSsMoJFOGvt60vBTK4vGbvZmfYny9Ts9sFw7C7/e9E0l/t8nuufeCQ13v2JcyGh+mw5fIkVqLC edxWxoWBphMPrErG5d36V62YktDAvgs1sRvSPMk+2JPTiRayVefY2zmMYleppu3oHo10VvU18D96W 5/pDlZNw==; Received: from 77.18.55.204.tmi.telenormobil.no ([77.18.55.204] helo=PedersHP) by castor.klingenberg.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ujkkN-0007rJ-VS for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2025 22:28:28 +0200 From: "Peder O. Klingenberg" Date: Wed, 06 Aug 2025 22:28:18 +0200 Message-ID: <871ppofb4t.fsf@klingenberg.no> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=176.125.234.34; envelope-from=peder@klingenberg.no; helo=castor.klingenberg.no X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Following on from bug#61916, there was one variable I missed that should also have a faux-dynamic binding: url-max-redirections. To demonstrate: (setq url-debug t) ;; and follow the results in the *URL-DEBUG* buffer (setq url-max-redirections 30) ;; the default (let ((url-max-redirections 0)) (url-retrieve "http://httpbin.org/redirect/5" #'(lambda (&rest _args) (message "done")))) This will cause 5 redirections to be followed by url-http.el, because it still sees url-max-redirections as 30. With the attached patch it stops after the first redirection. -- ...Peder... --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Emulate-dynamic-binding-of-url-max-redirections.patch >From 245b1935fdb9337b0e59932eefe6c62158eeff3d Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Wed, 6 Aug 2025 21:55:38 +0200 Subject: [PATCH] Emulate dynamic binding of url-max-redirections * lisp/url/url-http.el (url-http): Make url-max-redirections buffer-local in request buffers, to make dynamic binding over `url-retrieve` work as expected. --- lisp/url/url-http.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index a230a37e9ff..04fee189cfa 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1372,7 +1372,8 @@ url-http (httpver url-http-version) (httpkeepalive url-http-attempt-keepalives) (user-agent url-user-agent) - (privacy-level url-privacy-level)) + (privacy-level url-privacy-level) + (max-redirections url-max-redirections)) (if (not connection) ;; Failed to open the connection for some reason (progn @@ -1418,6 +1419,7 @@ url-http url-http-extensions-header url-user-agent url-privacy-level + url-max-redirections nsm-noninteractive)) (set (make-local-variable var) nil)) @@ -1447,6 +1449,7 @@ url-http url-http-extensions-header url-extensions-header url-user-agent user-agent url-privacy-level privacy-level + url-max-redirections max-redirections nsm-noninteractive noninteractive-p) (set-process-buffer connection buffer) -- 2.25.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 06 17:19:01 2025 Received: (at control) by debbugs.gnu.org; 6 Aug 2025 21:19:02 +0000 Received: from localhost ([127.0.0.1]:60470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ujlXJ-0004aH-JB for submit@debbugs.gnu.org; Wed, 06 Aug 2025 17:19:01 -0400 Received: from s17612523434.blix.com ([176.125.234.34]:47592 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 ) id 1ujlXH-0004a8-8y for control@debbugs.gnu.org; Wed, 06 Aug 2025 17:19:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=klingenberg.no; s=20200407; h=Subject:From:To:Message-Id:Date:Sender: Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+CxeAT0Y9J1wFY22W1bZYS9kDPsdUEMyrl2JEgc4bMQ=; b=M91b4mkqiyjTif/EiOCiAfyQIJ nnuWivo9Ey47gEAIh3Kw7GkjgaBM/YQq47kQgpR6IGMmOOPBatz9v19MxvUjiE9WPBJbIZp8C8QOK z1MxePmadQehbvk3ksJHq3BPBgN7MELXRd0nGUNGHDC6K1LexUp0bbAQGUzqZXECNxPoknyybJMAo nrHn293KGxtWCPy8WE4P3PfsHXG8vOvNjj0mD7K056CQ+ZnESnHEluOXAfA1RGhoyCkhcrmfObCEn aLaXOA812IIp+LduRcLVhmQ7vU854NtQNHK67XUyUaQT2jLs/jotQkbbxD8jFv+qRaRkEDKTXJ+sM frvyDezA==; Received: from 77.18.55.204.tmi.telenormobil.no ([77.18.55.204] helo=PedersHP) by castor.klingenberg.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ujlXE-0008II-Iv for control@debbugs.gnu.org; Wed, 06 Aug 2025 23:18:56 +0200 Date: Wed, 06 Aug 2025 23:18:47 +0200 Message-Id: <87zfccdu88.fsf@klingenberg.no> To: control@debbugs.gnu.org From: "Peder O. Klingenberg" Subject: control message for bug #79186 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 79186 + patch quit From unknown Fri Aug 15 18:12:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79186: 31.0.50; Make dynamic binding of url-max-redirections work Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Aug 2025 08:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 79186 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "Peder O. Klingenberg" Cc: 79186@debbugs.gnu.org Received: via spool by 79186-submit@debbugs.gnu.org id=B79186.175455508527585 (code B ref 79186); Thu, 07 Aug 2025 08:25:01 +0000 Received: (at 79186) by debbugs.gnu.org; 7 Aug 2025 08:24:45 +0000 Received: from localhost ([127.0.0.1]:33549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ujvvY-0007Ar-GR for submit@debbugs.gnu.org; Thu, 07 Aug 2025 04:24:44 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:57687) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ujvvV-0007AY-Q4 for 79186@debbugs.gnu.org; Thu, 07 Aug 2025 04:24:42 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3b780bdda21so495436f8f.3 for <79186@debbugs.gnu.org>; Thu, 07 Aug 2025 01:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754555075; x=1755159875; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BvhTtyqdztzavxLJ0YccJFqUqhNFGmSI4oq5gbdClgs=; b=M+j7l0kDqQe3a0JefbIwzkj2xhifqT7T9F0YIeHvI+jWoufHeJ1ltsAcC7y7k0eWuQ RVlnY9wGhrewkvM+Lgvih5++dn8rm6U+H9X5dO/bMysiTKxz+/yYJ+TB3HsuAHeijW9k 6DEGURJyMBLZiXFDmkIzOn7D39kETxSbMioheUqtuWY9Y2BYPXS4YKnkgHUHTuFhlNrW rGjV14cKtOmEbLodmqV/wdkT5uyJpNggQC2SZy4AgbY10VpMWwGTKx/SR24ZhiSzAMc1 pvEB9CLlJBgaU85PvcmivBjP7MiPxwAwaQIE+QgwOUSbJ4ZjrujPRBzOVZ24HG13BTCv 6xow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754555075; x=1755159875; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BvhTtyqdztzavxLJ0YccJFqUqhNFGmSI4oq5gbdClgs=; b=Dxgm5/8okxFg0JNPp2KgFHag+PaOlGC4HmIxys9K+lR7hvkOKh6GDRiJBv5rzAn4WP VKmwQKeVtvrRI+ctS96V17Mp0RChBCPxLky6wKWY15ZXjrOZ6Bm+KCRb0/bmXGDVADkr Bp7AzvWucuqZB+nUCT/dl0WydLQzGr75BTpkY0yEX4NGsqilFNWAmMMWYjLzxYqSy6Ku uBQfuPoPjpwiNDi1D+4BE9ajqXvxJa6g9CbcVdlJatoBgG8oo3qnnOMn8UnZ9yPwAysy oVIeM5XlOWsDV7Jr3Hmy9VwOiETOIayXZ9PnMrBhrRe9jypbzrQpi3RJ40LeEhTJmooh o/6Q== X-Gm-Message-State: AOJu0YztCYZ5m1ZvppPk3iaepwgLKIPNBs9C1HRoaKd6YNlmzCI3F1z9 74++bbvkkRH8Xvdmiw7GKhFnymB57BCeRGy/d/pIgR0MBfJ733KrHwyBYmrLgQ== X-Gm-Gg: ASbGncsZBM9t3MYOuEkyKh4LRK1X/0Epb/+C4cbvjnIstp7bgJhtgCSHkkEGXR4XJdN zIQgDY3PbbZLCmpmmvwi6I2nQ5xDY0QQ1QjOWyEBiq6gZOZk79CkXIIMw0CYTGBdJ7gK56MZMHq wazSLufI82XeujwccnThwcbaArbh4zPFRNNJuPi93hy//hzdGX3GMDjrOqsDQsP8XRlpCSdbjUs bGHknfj7z8i87+nlmrqqDph5ZwG6pq02oBhxDYxvu4CsMxYXXdOg2B56XCxxp9shf973xXFIAI/ RVGE2IvLbPZODZoSkz1L5zZnEp9Skwx/PgDojs/vb8nTRFnMo5wvHwGbz1chLCpap3j7vAV//+0 LNrJ0iFnU+Q== X-Google-Smtp-Source: AGHT+IH1gZ82OevwIkoK3n/SaskfpGbFahL9DW/UIzOubZkGaHEXksmvzqU3D8sgTLnYaXB50d8/4A== X-Received: by 2002:a5d:5d09:0:b0:3b7:83c0:a9e0 with SMTP id ffacd0b85a97d-3b8f48f9bedmr4804860f8f.25.1754555074468; Thu, 07 Aug 2025 01:24:34 -0700 (PDT) Received: from rltb ([2a01:e0a:3f3:fb51:2159:2435:7255:ba59]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b8e1cb7deesm15570432f8f.2.2025.08.07.01.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 01:24:34 -0700 (PDT) From: Robert Pluim In-Reply-To: <871ppofb4t.fsf@klingenberg.no> References: <871ppofb4t.fsf@klingenberg.no> Date: Thu, 07 Aug 2025 10:24:33 +0200 Message-ID: <87qzxn7d4u.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Wed, 06 Aug 2025 22:28:18 +0200, "Peder O. Klingenberg" said: Peder> Following on from bug#61916, there was one variable I missed tha= t should Peder> also have a faux-dynamic binding: url-max-redirections. Peder> To demonstrate: Peder> (setq url-debug t) ;; and follow the results in the *URL-DEBUG* = buffer Peder> (setq url-max-redirections 30) ;; the default Peder> (let ((url-max-redirections 0)) Peder> (url-retrieve "http://httpbin.org/redirect/5" Peder> #'(lambda (&rest _args) Peder> (message "done")))) Peder> This will cause 5 redirections to be followed by url-http.el, be= cause it Peder> still sees url-max-redirections as 30. Peder> With the attached patch it stops after the first redirection. I tried to apply this, but it failed because you quoted `like this`, which our commit hooks reject. Best is to quote 'like this' in commit messages and resubmit (this also gives you the chance to add (Bug#79186) somewhere in the commit message =F0=9F=98=80). Robert --=20 From unknown Fri Aug 15 18:12:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79186: 31.0.50; Make dynamic binding of url-max-redirections work Resent-From: "Peder O. Klingenberg" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Aug 2025 18:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 79186 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Robert Pluim Cc: 79186@debbugs.gnu.org Received: via spool by 79186-submit@debbugs.gnu.org id=B79186.175459047319980 (code B ref 79186); Thu, 07 Aug 2025 18:15:02 +0000 Received: (at 79186) by debbugs.gnu.org; 7 Aug 2025 18:14:33 +0000 Received: from localhost ([127.0.0.1]:35868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uk58L-0005CC-DJ for submit@debbugs.gnu.org; Thu, 07 Aug 2025 14:14:33 -0400 Received: from s17612523434.blix.com ([176.125.234.34]:38290 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 ) id 1uk58I-0005C1-E6 for 79186@debbugs.gnu.org; Thu, 07 Aug 2025 14:14:31 -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=reki36goDbJGfG8VIVvyYl5gp9RU7CxTfL2PJVpL3U0=; b=vi2dw+oH8OcaZTqufZXZYDzzq ua2dYcfM/APaJuIbztbT0CeIXk2W3QUQYMsncRPO/8scbR3K3TxCcUOCtncqP47ZHW52o6PuSDX58 1Z//v4iVZiPQrOOrzHNo3wp8NOctrGaEbDLQCZrdbAvUQxdc4U7bey1TJyXxNP9JvkpXuL8t/uRb5 pFmKLUJTVqsfMzwVsAIzh+awplOiI8xCcIgQtGt8G47YrEcEtgXafc/Z8gfkBt+lkiUV3cutw8jUk 8SuUunhyPc/tlSfnU9UdO7r4FBZ3FYiYyZSgpi4hYsqR6DgZFpOpxvkKoMiownhYm7Jn+mX4k5Ofm q3bxog8kg==; Received: from 77.18.55.204.tmi.telenormobil.no ([77.18.55.204] helo=PedersHP) by castor.klingenberg.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uk58F-0002cA-Nj; Thu, 07 Aug 2025 20:14:28 +0200 From: "Peder O. Klingenberg" In-Reply-To: <87qzxn7d4u.fsf@gmail.com> Organization: Persons in a Position to Know, inc. References: <871ppofb4t.fsf@klingenberg.no> <87qzxn7d4u.fsf@gmail.com> Date: Thu, 07 Aug 2025 20:14:26 +0200 Message-ID: <87sei3yp6l.fsf@klingenberg.no> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, 2025-08-07 10:24:33 +0200, Robert Pluim wrote: > I tried to apply this, but it failed because you quoted `like this`, > which our commit hooks reject. Best is to quote 'like this' in commit > messages and resubmit (this also gives you the chance to add > (Bug#79186) somewhere in the commit message =F0=9F=98=80). Thanks for the feedback. All these quoting standards are so confusing. We should all decide on a new standard that will subsume all previous standards. (Cue XKCD classic) Anyway. Updated patch attached. ...Peder... --=20 This must be Thursday. I never could get the hang of Thursdays. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Emulate-dynamic-binding-of-url-max-redirections-v2.patch >From 245b1935fdb9337b0e59932eefe6c62158eeff3d Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Wed, 6 Aug 2025 21:55:38 +0200 Subject: [PATCH] Emulate dynamic binding of url-max-redirections * lisp/url/url-http.el (url-http): Make url-max-redirections buffer-local in request buffers, to make dynamic binding over 'url-retrieve' work as expected. (Bug#79186) --- lisp/url/url-http.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index a230a37e9ff..04fee189cfa 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1372,7 +1372,8 @@ url-http (httpver url-http-version) (httpkeepalive url-http-attempt-keepalives) (user-agent url-user-agent) - (privacy-level url-privacy-level)) + (privacy-level url-privacy-level) + (max-redirections url-max-redirections)) (if (not connection) ;; Failed to open the connection for some reason (progn @@ -1418,6 +1419,7 @@ url-http url-http-extensions-header url-user-agent url-privacy-level + url-max-redirections nsm-noninteractive)) (set (make-local-variable var) nil)) @@ -1447,6 +1449,7 @@ url-http url-http-extensions-header url-extensions-header url-user-agent user-agent url-privacy-level privacy-level + url-max-redirections max-redirections nsm-noninteractive noninteractive-p) (set-process-buffer connection buffer) -- 2.25.1 --=-=-=-- From unknown Fri Aug 15 18:12:58 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Peder O. Klingenberg" Subject: bug#79186: closed (Re: bug#79186: 31.0.50; Make dynamic binding of url-max-redirections work) Message-ID: References: <86ms88lkz0.fsf@gnu.org> <871ppofb4t.fsf@klingenberg.no> X-Gnu-PR-Message: they-closed 79186 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 79186@debbugs.gnu.org Date: Sat, 09 Aug 2025 12:49:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1754743742-13987-1" This is a multi-part message in MIME format... ------------=_1754743742-13987-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #79186: 31.0.50; Make dynamic binding of url-max-redirections work which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 79186@debbugs.gnu.org. --=20 79186: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79186 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1754743742-13987-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 79186-done) by debbugs.gnu.org; 9 Aug 2025 12:48:30 +0000 Received: from localhost ([127.0.0.1]:40734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ukizu-0003ci-4U for submit@debbugs.gnu.org; Sat, 09 Aug 2025 08:48:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51252) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ukizs-0003cW-FX for 79186-done@debbugs.gnu.org; Sat, 09 Aug 2025 08:48:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ukizm-00072J-Hf; Sat, 09 Aug 2025 08:48:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=na07jYBGsjiny4Tvdo4t7d3Qyd6WCbkYcQrrpAlY7/Q=; b=pqBuCZSyLksmmmvgHy8d 2tS8p/mjze7VU7h/EY4G8Jy+EOYSgaHuXSEBfMVp1BNa2kthSiddmAMTYMtVCE4as92cIfGxxelhr J4ioU0eKGA6oZiIl5jPn5pjww7Zkn3iHjsgaIi/46beyOKjmba61BlNZP11598sgdoy2Ai1MjA153 xC2bGqBkNbIgd+7C/5TA3QxCibninl0tl9cyay3xtYYZDwDPRZMVlrgLuNsRUqWtWYYRBVIZqQvcF i/m4NfAXh/+576eVwX8Mb02FwSJXzE4LLCAklAn2k3Y+qKm/fRoYAnNpbjc5gu4zmGJW8JQx63GDc sNZMoAwsgFYBIA==; Date: Sat, 09 Aug 2025 15:48:19 +0300 Message-Id: <86ms88lkz0.fsf@gnu.org> From: Eli Zaretskii To: "Peder O. Klingenberg" In-Reply-To: <87sei3yp6l.fsf@klingenberg.no> (peder@klingenberg.no) Subject: Re: bug#79186: 31.0.50; Make dynamic binding of url-max-redirections work References: <871ppofb4t.fsf@klingenberg.no> <87qzxn7d4u.fsf@gmail.com> <87sei3yp6l.fsf@klingenberg.no> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79186-done Cc: rpluim@gmail.com, 79186-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 79186@debbugs.gnu.org > From: "Peder O. Klingenberg" > Date: Thu, 07 Aug 2025 20:14:26 +0200 > > On Thu, 2025-08-07 10:24:33 +0200, Robert Pluim wrote: > > > I tried to apply this, but it failed because you quoted `like this`, > > which our commit hooks reject. Best is to quote 'like this' in commit > > messages and resubmit (this also gives you the chance to add > > (Bug#79186) somewhere in the commit message 😀). > > Thanks for the feedback. All these quoting standards are so confusing. > We should all decide on a new standard that will subsume all previous > standards. (Cue XKCD classic) > > Anyway. Updated patch attached. Thanks, installed on master, and closing the bug. ------------=_1754743742-13987-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 6 Aug 2025 20:50:05 +0000 Received: from localhost ([127.0.0.1]:60439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ujl5J-0003FR-4C for submit@debbugs.gnu.org; Wed, 06 Aug 2025 16:50:05 -0400 Received: from lists.gnu.org ([2001:470:142::17]:36494) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ujl5G-0003Ds-Hp for submit@debbugs.gnu.org; Wed, 06 Aug 2025 16:50:03 -0400 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 ) id 1ujl57-0006n4-BS for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2025 16:49:53 -0400 Received: from s17612523434.blix.com ([176.125.234.34] helo=castor.klingenberg.no) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ujl53-0004TA-5A for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2025 16:49:51 -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: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uARor1cWRXGj4bH/TcGiTsFFyEHesr00o8UEvmPD1DQ=; b=VW3mWhq6TQV+xVhBQmlXG1luWB nOUuRnz9eI4DiJXmW7X4KrGtHj9HoZRI+U9kjdjHHFKxcr3j2/w9q5Wpmu+aJy/0a2T8JpElS6gDF B46ufskB3e0iatOZgT1ju7wT1Qo69lP49iast0wsZQR5gq3v+0Fu5KUIS3tgfFYrDHOlDjMGY+TEB GvlTSsMoJFOGvt60vBTK4vGbvZmfYny9Ts9sFw7C7/e9E0l/t8nuufeCQ13v2JcyGh+mw5fIkVqLC edxWxoWBphMPrErG5d36V62YktDAvgs1sRvSPMk+2JPTiRayVefY2zmMYleppu3oHo10VvU18D96W 5/pDlZNw==; Received: from 77.18.55.204.tmi.telenormobil.no ([77.18.55.204] helo=PedersHP) by castor.klingenberg.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ujkkN-0007rJ-VS for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2025 22:28:28 +0200 From: "Peder O. Klingenberg" To: bug-gnu-emacs@gnu.org Subject: 31.0.50; Make dynamic binding of url-max-redirections work Date: Wed, 06 Aug 2025 22:28:18 +0200 Message-ID: <871ppofb4t.fsf@klingenberg.no> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=176.125.234.34; envelope-from=peder@klingenberg.no; helo=castor.klingenberg.no X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Following on from bug#61916, there was one variable I missed that should also have a faux-dynamic binding: url-max-redirections. To demonstrate: (setq url-debug t) ;; and follow the results in the *URL-DEBUG* buffer (setq url-max-redirections 30) ;; the default (let ((url-max-redirections 0)) (url-retrieve "http://httpbin.org/redirect/5" #'(lambda (&rest _args) (message "done")))) This will cause 5 redirections to be followed by url-http.el, because it still sees url-max-redirections as 30. With the attached patch it stops after the first redirection. -- ...Peder... --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Emulate-dynamic-binding-of-url-max-redirections.patch >From 245b1935fdb9337b0e59932eefe6c62158eeff3d Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Wed, 6 Aug 2025 21:55:38 +0200 Subject: [PATCH] Emulate dynamic binding of url-max-redirections * lisp/url/url-http.el (url-http): Make url-max-redirections buffer-local in request buffers, to make dynamic binding over `url-retrieve` work as expected. --- lisp/url/url-http.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index a230a37e9ff..04fee189cfa 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1372,7 +1372,8 @@ url-http (httpver url-http-version) (httpkeepalive url-http-attempt-keepalives) (user-agent url-user-agent) - (privacy-level url-privacy-level)) + (privacy-level url-privacy-level) + (max-redirections url-max-redirections)) (if (not connection) ;; Failed to open the connection for some reason (progn @@ -1418,6 +1419,7 @@ url-http url-http-extensions-header url-user-agent url-privacy-level + url-max-redirections nsm-noninteractive)) (set (make-local-variable var) nil)) @@ -1447,6 +1449,7 @@ url-http url-http-extensions-header url-extensions-header url-user-agent user-agent url-privacy-level privacy-level + url-max-redirections max-redirections nsm-noninteractive noninteractive-p) (set-process-buffer connection buffer) -- 2.25.1 --=-=-=-- ------------=_1754743742-13987-1--