GNU logs - #54836, boring messages


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 1/2] http-client: Fix redirection.
Resent-From: Attila Lendvai <attila@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sun, 10 Apr 2022 13:35:03 +0000
Resent-Message-ID: <handler.54836.B.16495976952747 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 54836 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila@HIDDEN>
X-Debbugs-Original-To: guix-patches@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.16495976952747
          (code B ref -1); Sun, 10 Apr 2022 13:35:03 +0000
Received: (at submit) by debbugs.gnu.org; 10 Apr 2022 13:34:55 +0000
Received: from localhost ([127.0.0.1]:39751 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ndXiQ-0000iF-Qz
	for submit <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:34:55 -0400
Received: from lists.gnu.org ([209.51.188.17]:43166)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <attila.lendvai@HIDDEN>) id 1ndXiP-0000i8-PH
 for submit <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:34:54 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41078)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <attila.lendvai@HIDDEN>)
 id 1ndXiP-0000iT-Je
 for guix-patches@HIDDEN; Sun, 10 Apr 2022 09:34:53 -0400
Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:38514)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <attila.lendvai@HIDDEN>)
 id 1ndXiN-0002zx-Iw
 for guix-patches@HIDDEN; Sun, 10 Apr 2022 09:34:53 -0400
Received: by mail-ed1-x530.google.com with SMTP id z99so6598532ede.5
 for <guix-patches@HIDDEN>; Sun, 10 Apr 2022 06:34:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=RaDM0VnR0FPTk0OmW6s1pk3D+uH62ATdFz58/3F6nA0=;
 b=ZDrMB7ub6LoTRoaq2wKgyP4vZfJhfPEl+LqvE30+N3ktF8D/zAq3n6iILQbAcvEhis
 Iay51p/GiPZPSC7aKxWa9FcowQi4cGjqSRMr74Spld5nwKNt5Y+Nbxi0VwcSzC89vnCx
 lkicl0omQdoW2aTEkQ/R7gKd/8zggUZEKcuHkd0LOpEsqEzQuEdFke9fpZs31coh86eh
 KKuTnvyw3nHpwpDC/eQJRwJiQSVydTn4g7HE3Fqo0u/d4dDjMKJGl7gcdA4dp+1xIUwI
 fRvISpDG71Fs0fjbDzl3Ge8mOyi0ERa3QaNYxN/+Vkmi/iMFf+jPJj7y4tJpYg8WEvig
 Ihiw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:from:to:cc:subject:date:message-id
 :mime-version:content-transfer-encoding;
 bh=RaDM0VnR0FPTk0OmW6s1pk3D+uH62ATdFz58/3F6nA0=;
 b=FNYL7x37wD2Uu/nPJrnap7V/vfkozLDyJ5E9Q8CM4DBULca8LyVWnVF5NFp8UshE8F
 HrFeknBhBNdisL0Uh+2qXimE34hkXyGQVjgH5AQPHFc4+X4D8wyhsQhOMXPSYZc6AYCG
 0wNIVcoLGbl/Z97Lny4rTu1fSMAbKFTvr8uKtN7JXCEyWHMW3KTOOU/sFNV+qdl+B2c1
 DsbZc3PE+1cRyOGFsCsX3bGVEm2difMMYm29fSVC7k7qh/fbWc2hTMVOz5uF2I0MCmFk
 ENWgJVAJLpRFQcM4O9zvAczGCxdn7AfV0vslvg/mMZrc38arczTfDBfMucWNcXZz8kbu
 Qztg==
X-Gm-Message-State: AOAM532OpAIK/9/fkvkHvSxdoL7LmMZBsFr1GTjpDuefq0kxTdguyQPO
 KzQmpfKW8TpBiVu7cooxpl5czlJgsFI=
X-Google-Smtp-Source: ABdhPJwO/UxmV7c5puDhOGLEgrZeJd4AQgY9KXaHfP++3BH0kR7zSVdL61nhvvIWX7adCXdpLKIpng==
X-Received: by 2002:a05:6402:158b:b0:41d:4a47:cde5 with SMTP id
 c11-20020a056402158b00b0041d4a47cde5mr11062589edv.312.1649597689404; 
 Sun, 10 Apr 2022 06:34:49 -0700 (PDT)
Received: from localhost.localdomain ([2a02:ab88:7509:f780:ed82:a496:f55:e07b])
 by smtp.gmail.com with ESMTPSA id
 r16-20020a056402019000b00418ed60c332sm13473698edv.65.2022.04.10.06.34.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 10 Apr 2022 06:34:48 -0700 (PDT)
From: Attila Lendvai <attila@HIDDEN>
Date: Sun, 10 Apr 2022 15:34:31 +0200
Message-Id: <20220410133431.30058-1-attila@HIDDEN>
X-Mailer: git-send-email 2.34.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::530;
 envelope-from=attila.lendvai@HIDDEN; helo=mail-ed1-x530.google.com
X-Spam_score_int: -14
X-Spam_score: -1.5
X-Spam_bar: -
X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249,
 FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.8 (/)
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.8 (-)

* guix/http-client.scm (http-fetch): Use the right uri variable in case of
redirection.
---
 guix/http-client.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/http-client.scm b/guix/http-client.scm
index 8a5b3deecd..b8689a22ed 100644
--- a/guix/http-client.scm
+++ b/guix/http-client.scm
@@ -148,7 +148,7 @@ (define uri*
                             (or (not (uri-host uri))
                                 (string=? host (uri-host uri)))
                             port)
-                       (open-connection uri*
+                       (open-connection uri
                                         #:verify-certificate?
                                         verify-certificate?
                                         #:timeout timeout)))))
-- 
2.34.0





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Attila Lendvai <attila@HIDDEN>
Subject: bug#54836: Acknowledgement ([PATCH 1/2] http-client: Fix
 redirection.)
Message-ID: <handler.54836.B.16495976952747.ack <at> debbugs.gnu.org>
References: <20220410133431.30058-1-attila@HIDDEN>
X-Gnu-PR-Message: ack 54836
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 54836 <at> debbugs.gnu.org
Date: Sun, 10 Apr 2022 13:35:03 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 54836 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
54836: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D54836
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 2/2] http-client: Factor out open-connection*, rename variables.
References: <20220410133431.30058-1-attila@HIDDEN>
In-Reply-To: <20220410133431.30058-1-attila@HIDDEN>
Resent-From: Attila Lendvai <attila@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sun, 10 Apr 2022 13:37:01 +0000
Resent-Message-ID: <handler.54836.B54836.16495977732923 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 54836 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila@HIDDEN>
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.16495977732923
          (code B ref 54836); Sun, 10 Apr 2022 13:37:01 +0000
Received: (at 54836) by debbugs.gnu.org; 10 Apr 2022 13:36:13 +0000
Received: from localhost ([127.0.0.1]:39758 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ndXjh-0000l5-5Z
	for submit <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:36:13 -0400
Received: from mail-ed1-f48.google.com ([209.85.208.48]:43969)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <attila.lendvai@HIDDEN>) id 1ndXjf-0000kp-EY
 for 54836 <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:36:11 -0400
Received: by mail-ed1-f48.google.com with SMTP id b24so15174327edu.10
 for <54836 <at> debbugs.gnu.org>; Sun, 10 Apr 2022 06:36:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=Jr3nk6fSgo+JsRrC1wJ6HC4Iz1hEn92rKHFW91BQOa0=;
 b=c2vY5Tl75Qc6iKH8GQR2wbDDal62rWL8fBm1MNeeE7k1zyNurlMU/y0LMLUGJCy2cp
 JmoT+RXc3aMgecDPj6QyMzU7G4dgsGwYkuiDwIPvcC2Wch4fv81us6r3umyeZ+iHzxI5
 fZBAGmYP0t6NnH+y8zmY49phy1EIeGY/GZ7LR9WKdnXUx8Gu9st1egMj4w3piMYtjMR6
 p7cxYvxYeIabMWY8ueo4+BfaGXakqe1LpU9TSB8eVCSmy8EVyR82TI9Z1r5SsqQ3AdKP
 QjAkPJMpFuRv/XmiF4RROGftWnpKhcG7b6qKaYETbXi92tPHLHYgiTgHKQJPshYctBAT
 593g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:from:to:cc:subject:date:message-id
 :mime-version:content-transfer-encoding;
 bh=Jr3nk6fSgo+JsRrC1wJ6HC4Iz1hEn92rKHFW91BQOa0=;
 b=mrNrj4jjCfggYUdAxQouQ46bvSjYg5JfApPO89XfXq3uZjVCu4+8x1+/4fudvU4xCi
 k95z1WKE9mDcM0agdmuQdShK/VnLMJrGdCs+geE3dNFRgeWlzNAOVGscLJ7Xp2ppGzo3
 GrESrq5HFcWi1sHLrsAk0BLXPsx3p2pVsFBAl+ZwTyZEbE1NbaXwoe5vDPOzNTvvLqHq
 ThfpmwEDvkC5rTc9tB3v2/Wr66NIgsR9brLCYKL/yCZ7S8B60k8OHrRxfZ1ohZIYLn9H
 QOeofnDOvLf//3XFpSXlCY8s+HYCuqShwSUUnYTJJiStUl+ON6GHpReFenzvxVQUsBcA
 2hsA==
X-Gm-Message-State: AOAM533NIaiNbXXj5/8ar0mdsZ0BabZNujfnAZ7anoyfkyLe50BwQGYN
 paPqeB/MgFNOGhtXpAZDQkGe4ICfyV0=
X-Google-Smtp-Source: ABdhPJw4VNPBzXPTjedaWYjm6qzTFaKcB2KyseBkd0gkc/ltTIydp5cbVb6Pz7vmb/p9L9pTPSd8dg==
X-Received: by 2002:aa7:d98f:0:b0:41c:bf0f:4c45 with SMTP id
 u15-20020aa7d98f000000b0041cbf0f4c45mr28718254eds.379.1649597764308; 
 Sun, 10 Apr 2022 06:36:04 -0700 (PDT)
Received: from localhost.localdomain ([2a02:ab88:7509:f780:ed82:a496:f55:e07b])
 by smtp.gmail.com with ESMTPSA id
 c4-20020a170906340400b006d077e850b5sm10739645ejb.23.2022.04.10.06.36.03
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 10 Apr 2022 06:36:03 -0700 (PDT)
From: Attila Lendvai <attila@HIDDEN>
Date: Sun, 10 Apr 2022 15:35:37 +0200
Message-Id: <20220410133536.30422-2-attila@HIDDEN>
X-Mailer: git-send-email 2.34.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.5 (/)
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: -0.5 (/)

This is an idempotent refactor.

* guix/http-client.scm (http-fetch): Introduce open-connection*. Rename some
variables to turn programmer mistakes into compile errors.
---
 guix/http-client.scm | 48 ++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/guix/http-client.scm b/guix/http-client.scm
index b8689a22ed..3c5115068d 100644
--- a/guix/http-client.scm
+++ b/guix/http-client.scm
@@ -103,15 +103,17 @@ (define* (http-fetch uri #:key port (text? #f) (buffered? #t)
 When ACCEPT-ALL-RESPONSE-CODES? is false then raise an '&http-get-error'
 condition if downloading fails, otherwise return the response regardless
 of the reponse code."
-  (define uri*
+  (define parsed-initial-uri
     (if (string? uri) (string->uri uri) uri))
 
-  (let loop ((uri uri*)
-             (port (or port (open-connection uri*
-                                             #:verify-certificate?
-                                             verify-certificate?
-                                             #:timeout timeout))))
-    (let ((headers (match (uri-userinfo uri)
+  (define (open-connection* uri)
+    (open-connection uri
+                     #:verify-certificate? verify-certificate?
+                     #:timeout timeout))
+
+  (let loop ((current-uri parsed-initial-uri)
+             (current-port (or port (open-connection parsed-initial-uri))))
+    (let ((headers (match (uri-userinfo current-uri)
                      ((? string? str)
                       (cons (cons 'Authorization
                                   (string-append "Basic "
@@ -119,10 +121,10 @@ (define uri*
                                                   (string->utf8 str))))
                             headers))
                      (_ headers))))
-      (unless (or buffered? (not (file-port? port)))
-        (setvbuf port 'none))
+      (unless (or buffered? (not (file-port? current-port)))
+        (setvbuf current-port 'none))
       (let*-values (((resp data)
-                     (http-get uri #:streaming? #t #:port port
+                     (http-get current-uri #:streaming? #t #:port current-port
                                #:keep-alive? keep-alive?
                                #:headers headers))
                     ((code)
@@ -135,28 +137,26 @@ (define uri*
             303                                   ; see other
             307                                   ; temporary redirection
             308)                                  ; permanent redirection
-           (let ((host (uri-host uri))
-                 (uri  (resolve-uri-reference (response-location resp) uri)))
+           (let ((host (uri-host current-uri))
+                 (new-uri (resolve-uri-reference (response-location resp)
+                                                 current-uri)))
              (if keep-alive?
                  (dump-port data (%make-void-port "w0")
                             (response-content-length resp))
-                 (close-port port))
+                 (close-port current-port))
              (format log-port (G_ "following redirection to `~a'...~%")
-                     (uri->string uri))
-             (loop uri
+                     (uri->string new-uri))
+             (loop new-uri
                    (or (and keep-alive?
-                            (or (not (uri-host uri))
-                                (string=? host (uri-host uri)))
-                            port)
-                       (open-connection uri
-                                        #:verify-certificate?
-                                        verify-certificate?
-                                        #:timeout timeout)))))
+                            (or (not (uri-host new-uri))
+                                (string=? host (uri-host new-uri)))
+                            current-port)
+                       (open-connection* new-uri)))))
           (else
            (if accept-all-response-codes?
                (values data (response-content-length resp))
                (raise (condition (&http-get-error
-                                  (uri uri)
+                                  (uri current-uri)
                                   (code code)
                                   (reason (response-reason-phrase resp))
                                   (headers (response-headers resp)))
@@ -165,7 +165,7 @@ (define uri*
                                    (format
                                     #f
                                     (G_ "~a: HTTP download failed: ~a (~s)")
-                                    (uri->string uri) code
+                                    (uri->string current-uri) code
                                     (response-reason-phrase resp)))))))))))))
 
 (define-syntax-rule (false-if-networking-error exp)
-- 
2.34.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH v2 1/3] http-client: Added accept-all-response-codes? argument.
References: <20220410133431.30058-1-attila@HIDDEN>
In-Reply-To: <20220410133431.30058-1-attila@HIDDEN>
Resent-From: Attila Lendvai <attila@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sun, 10 Apr 2022 13:45:01 +0000
Resent-Message-ID: <handler.54836.B54836.16495982923765 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 54836 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila@HIDDEN>
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.16495982923765
          (code B ref 54836); Sun, 10 Apr 2022 13:45:01 +0000
Received: (at 54836) by debbugs.gnu.org; 10 Apr 2022 13:44:52 +0000
Received: from localhost ([127.0.0.1]:39762 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ndXs4-0000ye-45
	for submit <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:44:52 -0400
Received: from mail-ed1-f54.google.com ([209.85.208.54]:40481)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <attila.lendvai@HIDDEN>) id 1ndXs1-0000yL-Sr
 for 54836 <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:44:50 -0400
Received: by mail-ed1-f54.google.com with SMTP id v4so1720411edl.7
 for <54836 <at> debbugs.gnu.org>; Sun, 10 Apr 2022 06:44:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=++3ok8LxQxAfqdef0Oab922kDhcqy0nEv2t3ab3GQ7M=;
 b=df/eAmBjq/hvxwW4yIHjwMvknW8A++InQJEwxvR1Y722E6XFbaS41yqcMLq/NXfbni
 U/2heogZc9R+Kq8AbqmAY1NPkUWkh1SFhJ35ygX/InXljBtqSaZSdkjdW8yeGOpfKKSQ
 X3GKbnbcmnQVL0ElcmTxX5kI/KHSCQmlaRuSAce3EvKPr01WemwiGcCNSkXKqwZiOkyk
 UNWWL+cFuGgr8AXwltUDUrAs2ugBzntwg4OO0OeIgM2h8+pnmzKbtyQfaByWyewJalRD
 RQwHkP6It7y0BjEMc87UQ+KqbD918PsvIqDFFbZ3qpAtMze/J8Shz92TVB6gaRDOgIWN
 XIDw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:from:to:cc:subject:date:message-id
 :mime-version:content-transfer-encoding;
 bh=++3ok8LxQxAfqdef0Oab922kDhcqy0nEv2t3ab3GQ7M=;
 b=pM6nI1qSSJltugXMQ6n+GuATfBF7yDbV2nPbdF09RkBtekY1y+Nqbn3oh2gVCwoJ/R
 re9xeVRq1JUUF4mzTvFmMrpqvs7Swy0AqLyWVxuz4zch16D+drBdmAbd7cKb9EoYpYBR
 gzOQSWCoj+sqae8wfogrsOWlL07d8e1WZ8qcyQjOGxGvR0ar8wHbxq3VqWrKE47xqAqe
 qAbGBkVWYQnZyiqZLfFP1JMIIUW+NBc10qv4eGPYj9lpkn37NK7OaDE/2SQOP7igVasc
 BrVON1E8ndWvGiq3EwfW60yPhDM4Ts3dzFtcF1NnIgUz8IBBb2KYJmjtv3/FqmOArz/i
 6XAw==
X-Gm-Message-State: AOAM533Bi08kT1UUf0Eon4bVQWE9FNtANweyOH5vsJGIgMV5ABe0GA+N
 ynDZk+r9TPwyUQw0LFABHjnFsVlsDag=
X-Google-Smtp-Source: ABdhPJwAuLJ3qNC+BxCUXXzFWU34Ttkhy5wcwP4xrhUHjaWikyj92i1O3diaJll1zqZz3/CNy8ydig==
X-Received: by 2002:aa7:c612:0:b0:41d:7ad7:4a4d with SMTP id
 h18-20020aa7c612000000b0041d7ad74a4dmr820442edq.125.1649598283998; 
 Sun, 10 Apr 2022 06:44:43 -0700 (PDT)
Received: from localhost.localdomain ([2a02:ab88:7509:f780:ed82:a496:f55:e07b])
 by smtp.gmail.com with ESMTPSA id
 p24-20020a056402045800b0041614c8f79asm13232201edw.88.2022.04.10.06.44.43
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 10 Apr 2022 06:44:43 -0700 (PDT)
From: Attila Lendvai <attila@HIDDEN>
Date: Sun, 10 Apr 2022 15:41:13 +0200
Message-Id: <20220410134114.371-1-attila@HIDDEN>
X-Mailer: git-send-email 2.34.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.5 (/)
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: -0.5 (/)

This is needed when dealing with golang packages, as per:
https://golang.org/ref/mod#vcs-find

A page may return 404, but at the same time also contain the sought after
`go-import` meta tag.  An example for such a project/page is:
https://www.gonum.org/v1/gonum?go-get=1

It's not enough to just handle the thrown exception, because we need to be
able to get hold of the fetched content, too.

* guix/http-client.scm (http-fetch): Add #:accept-all-response-codes? keyword
argument defaulting to #f, and implement the logic.
---

oops, resending because the first version doesn't apply on master.

v2 also contains an initial commit, a feature addition that is needed
for my (soon to be sent) improvements to the go importer.

 guix/http-client.scm | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/guix/http-client.scm b/guix/http-client.scm
index 143ed6de31..8a5b3deecd 100644
--- a/guix/http-client.scm
+++ b/guix/http-client.scm
@@ -82,7 +82,8 @@ (define* (http-fetch uri #:key port (text? #f) (buffered? #t)
                      (verify-certificate? #t)
                      (headers '((user-agent . "GNU Guile")))
                      (log-port (current-error-port))
-                     timeout)
+                     timeout
+                     (accept-all-response-codes? #f))
   "Return an input port containing the data at URI, and the expected number of
 bytes available or #f.  If TEXT? is true, the data at URI is considered to be
 textual.  Follow any HTTP redirection.  When BUFFERED? is #f, return an
@@ -99,7 +100,9 @@ (define* (http-fetch uri #:key port (text? #f) (buffered? #t)
 
 Write information about redirects to LOG-PORT.
 
-Raise an '&http-get-error' condition if downloading fails."
+When ACCEPT-ALL-RESPONSE-CODES? is false then raise an '&http-get-error'
+condition if downloading fails, otherwise return the response regardless
+of the reponse code."
   (define uri*
     (if (string? uri) (string->uri uri) uri))
 
@@ -150,18 +153,20 @@ (define uri*
                                         verify-certificate?
                                         #:timeout timeout)))))
           (else
-           (raise (condition (&http-get-error
-                              (uri uri)
-                              (code code)
-                              (reason (response-reason-phrase resp))
-                              (headers (response-headers resp)))
-                             (&message
-                              (message
-                               (format
-                                #f
-                                (G_ "~a: HTTP download failed: ~a (~s)")
-                                (uri->string uri) code
-                                (response-reason-phrase resp))))))))))))
+           (if accept-all-response-codes?
+               (values data (response-content-length resp))
+               (raise (condition (&http-get-error
+                                  (uri uri)
+                                  (code code)
+                                  (reason (response-reason-phrase resp))
+                                  (headers (response-headers resp)))
+                                 (&message
+                                  (message
+                                   (format
+                                    #f
+                                    (G_ "~a: HTTP download failed: ~a (~s)")
+                                    (uri->string uri) code
+                                    (response-reason-phrase resp)))))))))))))
 
 (define-syntax-rule (false-if-networking-error exp)
   "Return #f if EXP triggers a network related exception as can occur when
-- 
2.34.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 2/3] http-client: Fix redirection.
Resent-From: Attila Lendvai <attila@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sun, 10 Apr 2022 13:45:02 +0000
Resent-Message-ID: <handler.54836.B54836.16495982943779 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 54836 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila@HIDDEN>
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.16495982943779
          (code B ref 54836); Sun, 10 Apr 2022 13:45:02 +0000
Received: (at 54836) by debbugs.gnu.org; 10 Apr 2022 13:44:54 +0000
Received: from localhost ([127.0.0.1]:39765 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ndXs6-0000yt-GU
	for submit <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:44:54 -0400
Received: from mail-ej1-f44.google.com ([209.85.218.44]:44811)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <attila.lendvai@HIDDEN>) id 1ndXs5-0000yP-3y
 for 54836 <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:44:53 -0400
Received: by mail-ej1-f44.google.com with SMTP id u15so7237033ejf.11
 for <54836 <at> debbugs.gnu.org>; Sun, 10 Apr 2022 06:44:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=RaDM0VnR0FPTk0OmW6s1pk3D+uH62ATdFz58/3F6nA0=;
 b=kx4VY2eDyxP9FpHCr4wEyQ1F85PjFSjV489y8RihiNl1jHSMVBc099mZa5MdBKKGAs
 RL6MFdvhTzt1xua+HRm7uJFVx2zRGTy51HDzi2cYtAOmnLc9lcCd6pHCveJLB42m7XC/
 /BZ/mJ3BqITZj/rLBbPZdxkGm5e+3l8eelIIacjLmaID5XoIcBNAJkVo5D3yXwbefzvB
 gwbNjCq9eOp063wOA31tIbpYPRe5caFguI/X6d1bnlWr+kRguzVR1IwsIJA8T1NDTn96
 cxgpTY3wiWb7e76CkYZhTzDQ0gnCeSVseOcOVdMp4QzAiX2Tco5EMga7i3QKxHWY01hj
 0ypQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:from:to:cc:subject:date:message-id
 :in-reply-to:references:mime-version:content-transfer-encoding;
 bh=RaDM0VnR0FPTk0OmW6s1pk3D+uH62ATdFz58/3F6nA0=;
 b=VndoYD3b+IoeFNqGmiMWbo2z8YFPInm37llxjQ9Rx+6NHlSs+SeUmTENPdOO2QUFrY
 0Htg/hDmZ9p/ggt4yv2zkOufAQX0vQsawZm+8lc4azixaJ27w56ZsiJ/1kx7IPPNLgVR
 72agg6Pyk7sICGt+wUZy7Q/pNzaXH9w30nLvn33OWsi6huORgGnhQ6x9qGk+5UDb0umq
 WpLzW+bo1r1HE3LvDYFTwrWgrfBh7Fbvy4iLNL+1dSw7CilucBohPsViqCxZQ1BkKRa/
 U7KaG9Vsg0qLZXQMlJrEbY8ZCjF2ovJSQVjijKaeP9+z8y4NcXjXc7xXqXcP7Z0ug0w7
 UToQ==
X-Gm-Message-State: AOAM531XOMEHn08JZyL6RP1HfVSRfBsB1hJ7VyJ+0FCPjsYB1VbmQqfw
 X89oPGLZAQgPrcxhxEYrvoBufE1wwQc=
X-Google-Smtp-Source: ABdhPJxlVSznoJ1zyzo3ol+Qetw4sPvNn+a/9IKDTb/mXp0n849mQfN5Q1Ows05m/9+NPDLKyGfeIg==
X-Received: by 2002:a17:907:72c5:b0:6da:e99e:226c with SMTP id
 du5-20020a17090772c500b006dae99e226cmr26643875ejc.515.1649598287324; 
 Sun, 10 Apr 2022 06:44:47 -0700 (PDT)
Received: from localhost.localdomain ([2a02:ab88:7509:f780:ed82:a496:f55:e07b])
 by smtp.gmail.com with ESMTPSA id
 p24-20020a056402045800b0041614c8f79asm13232201edw.88.2022.04.10.06.44.46
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 10 Apr 2022 06:44:46 -0700 (PDT)
From: Attila Lendvai <attila@HIDDEN>
Date: Sun, 10 Apr 2022 15:41:14 +0200
Message-Id: <20220410134114.371-2-attila@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <20220410134114.371-1-attila@HIDDEN>
References: <20220410134114.371-1-attila@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.5 (/)
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: -0.5 (/)

* guix/http-client.scm (http-fetch): Use the right uri variable in case of
redirection.
---
 guix/http-client.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/http-client.scm b/guix/http-client.scm
index 8a5b3deecd..b8689a22ed 100644
--- a/guix/http-client.scm
+++ b/guix/http-client.scm
@@ -148,7 +148,7 @@ (define uri*
                             (or (not (uri-host uri))
                                 (string=? host (uri-host uri)))
                             port)
-                       (open-connection uri*
+                       (open-connection uri
                                         #:verify-certificate?
                                         verify-certificate?
                                         #:timeout timeout)))))
-- 
2.34.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 3/3] http-client: Factor out open-connection*, rename variables.
Resent-From: Attila Lendvai <attila@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sun, 10 Apr 2022 13:45:02 +0000
Resent-Message-ID: <handler.54836.B54836.16495982983794 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 54836 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila@HIDDEN>
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.16495982983794
          (code B ref 54836); Sun, 10 Apr 2022 13:45:02 +0000
Received: (at 54836) by debbugs.gnu.org; 10 Apr 2022 13:44:58 +0000
Received: from localhost ([127.0.0.1]:39768 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ndXs9-0000z7-N2
	for submit <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:44:58 -0400
Received: from mail-ed1-f44.google.com ([209.85.208.44]:36483)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <attila.lendvai@HIDDEN>) id 1ndXs7-0000ya-UW
 for 54836 <at> debbugs.gnu.org; Sun, 10 Apr 2022 09:44:56 -0400
Received: by mail-ed1-f44.google.com with SMTP id u18so4546392eda.3
 for <54836 <at> debbugs.gnu.org>; Sun, 10 Apr 2022 06:44:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=Jr3nk6fSgo+JsRrC1wJ6HC4Iz1hEn92rKHFW91BQOa0=;
 b=n9ApJ5g3i2LTMJU9hqvEaxBY5n/EmF1aOEmLtCTaqILTf54zWyrRKvyc33u3zo2eWN
 nPLd6WPtGdM16f49O98Jwf2WoEjNKpFvtwgCNI61SKqBdvUEHLXzaZigtk7HrMLQKt7C
 y9gX9PaXDhxpvCFJRPeP+lLxKBjW/R24ZgEaX1JUO/zXXOhxB2O1kXksH7qXzktSC+En
 GEA3wlMVd2D9ps82soHq7mRJbdrODTPiqHOdpjoabOZuSr5N9M1AO0PxxvjMOPRq8CBi
 WpkVhP+G32pGR7XMryC/exROP67c1iSEkxI14yZkFSuUDCo2y5K9cernKeEOh+C6nq/j
 b6kA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:from:to:cc:subject:date:message-id
 :in-reply-to:references:mime-version:content-transfer-encoding;
 bh=Jr3nk6fSgo+JsRrC1wJ6HC4Iz1hEn92rKHFW91BQOa0=;
 b=woONAZ/2UXQPt0MxE9jpSGLWpunetlOpG7XJUwruYwUWlobL6FBKdAs83An+mRob0a
 lI9vfJFyx2rzuefymGv7rcy87itQ3wTQfjQTch7FoLSxSU5FwDn+cTxn9/0Kh4FSh9y7
 /cmMykMaPdClVbYg2kNkifyVIq90pWAs4zlq2xBIq6dRzyajRbUnaJY/FroLIcvseQDm
 Kbfrrk4lUXpRPifuP/I3KhWYg6DN8PeskzJWHE58R5kyXxDeTcRj9zSqKPT3k6Dcr9/m
 UyBnTDOYEIWAonSMt9J0sbCxNe6XRCTIsYh4pQRpLwH63Ds8Nx+Lj+oEecUz2uKsKw9M
 X+Zw==
X-Gm-Message-State: AOAM532Wa9d/OvkK+kfA5fjnmjHos1rBeuaLMleamCOUJamF2ZCOKrYl
 NsqIw0mXURxRLJAllBOuvF2QNpcNqlA=
X-Google-Smtp-Source: ABdhPJzq79XElT1HcKQYjwqH/t7Xpt51jsKo+3z2MIlcZWmyg7Gn5u8d6nDyYEp3PSRHzspxsEdnKg==
X-Received: by 2002:a05:6402:298c:b0:41d:6b63:aa67 with SMTP id
 eq12-20020a056402298c00b0041d6b63aa67mr7081575edb.42.1649598290300; 
 Sun, 10 Apr 2022 06:44:50 -0700 (PDT)
Received: from localhost.localdomain ([2a02:ab88:7509:f780:ed82:a496:f55:e07b])
 by smtp.gmail.com with ESMTPSA id
 p24-20020a056402045800b0041614c8f79asm13232201edw.88.2022.04.10.06.44.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 10 Apr 2022 06:44:49 -0700 (PDT)
From: Attila Lendvai <attila@HIDDEN>
Date: Sun, 10 Apr 2022 15:41:15 +0200
Message-Id: <20220410134114.371-3-attila@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <20220410134114.371-1-attila@HIDDEN>
References: <20220410134114.371-1-attila@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.5 (/)
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: -0.5 (/)

This is an idempotent refactor.

* guix/http-client.scm (http-fetch): Introduce open-connection*. Rename some
variables to turn programmer mistakes into compile errors.
---
 guix/http-client.scm | 48 ++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/guix/http-client.scm b/guix/http-client.scm
index b8689a22ed..3c5115068d 100644
--- a/guix/http-client.scm
+++ b/guix/http-client.scm
@@ -103,15 +103,17 @@ (define* (http-fetch uri #:key port (text? #f) (buffered? #t)
 When ACCEPT-ALL-RESPONSE-CODES? is false then raise an '&http-get-error'
 condition if downloading fails, otherwise return the response regardless
 of the reponse code."
-  (define uri*
+  (define parsed-initial-uri
     (if (string? uri) (string->uri uri) uri))
 
-  (let loop ((uri uri*)
-             (port (or port (open-connection uri*
-                                             #:verify-certificate?
-                                             verify-certificate?
-                                             #:timeout timeout))))
-    (let ((headers (match (uri-userinfo uri)
+  (define (open-connection* uri)
+    (open-connection uri
+                     #:verify-certificate? verify-certificate?
+                     #:timeout timeout))
+
+  (let loop ((current-uri parsed-initial-uri)
+             (current-port (or port (open-connection parsed-initial-uri))))
+    (let ((headers (match (uri-userinfo current-uri)
                      ((? string? str)
                       (cons (cons 'Authorization
                                   (string-append "Basic "
@@ -119,10 +121,10 @@ (define uri*
                                                   (string->utf8 str))))
                             headers))
                      (_ headers))))
-      (unless (or buffered? (not (file-port? port)))
-        (setvbuf port 'none))
+      (unless (or buffered? (not (file-port? current-port)))
+        (setvbuf current-port 'none))
       (let*-values (((resp data)
-                     (http-get uri #:streaming? #t #:port port
+                     (http-get current-uri #:streaming? #t #:port current-port
                                #:keep-alive? keep-alive?
                                #:headers headers))
                     ((code)
@@ -135,28 +137,26 @@ (define uri*
             303                                   ; see other
             307                                   ; temporary redirection
             308)                                  ; permanent redirection
-           (let ((host (uri-host uri))
-                 (uri  (resolve-uri-reference (response-location resp) uri)))
+           (let ((host (uri-host current-uri))
+                 (new-uri (resolve-uri-reference (response-location resp)
+                                                 current-uri)))
              (if keep-alive?
                  (dump-port data (%make-void-port "w0")
                             (response-content-length resp))
-                 (close-port port))
+                 (close-port current-port))
              (format log-port (G_ "following redirection to `~a'...~%")
-                     (uri->string uri))
-             (loop uri
+                     (uri->string new-uri))
+             (loop new-uri
                    (or (and keep-alive?
-                            (or (not (uri-host uri))
-                                (string=? host (uri-host uri)))
-                            port)
-                       (open-connection uri
-                                        #:verify-certificate?
-                                        verify-certificate?
-                                        #:timeout timeout)))))
+                            (or (not (uri-host new-uri))
+                                (string=? host (uri-host new-uri)))
+                            current-port)
+                       (open-connection* new-uri)))))
           (else
            (if accept-all-response-codes?
                (values data (response-content-length resp))
                (raise (condition (&http-get-error
-                                  (uri uri)
+                                  (uri current-uri)
                                   (code code)
                                   (reason (response-reason-phrase resp))
                                   (headers (response-headers resp)))
@@ -165,7 +165,7 @@ (define uri*
                                    (format
                                     #f
                                     (G_ "~a: HTTP download failed: ~a (~s)")
-                                    (uri->string uri) code
+                                    (uri->string current-uri) code
                                     (response-reason-phrase resp)))))))))))))
 
 (define-syntax-rule (false-if-networking-error exp)
-- 
2.34.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 1/2] http-client: Fix redirection.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Mon, 11 Apr 2022 12:45:02 +0000
Resent-Message-ID: <handler.54836.B54836.164968105312912 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Attila Lendvai <attila@HIDDEN>
Cc: 54836 <at> debbugs.gnu.org
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.164968105312912
          (code B ref 54836); Mon, 11 Apr 2022 12:45:02 +0000
Received: (at 54836) by debbugs.gnu.org; 11 Apr 2022 12:44:13 +0000
Received: from localhost ([127.0.0.1]:43025 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ndtOu-0003MB-OA
	for submit <at> debbugs.gnu.org; Mon, 11 Apr 2022 08:44:12 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37938)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1ndtOt-0003Lw-4B
 for 54836 <at> debbugs.gnu.org; Mon, 11 Apr 2022 08:44:11 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:36630)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1ndtOm-000849-VR; Mon, 11 Apr 2022 08:44:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=fwtEFv1c/Naw7OfxjGioV7ltzTaPa/mgMgIWo0JL9S4=; b=IHapZ4FZyJEo0NAJ9jG7
 lEQNisl/naGs1P5rbMr3qSyZXhsy9bqhgcZMwpqy8DX6EWhhWkNxJhZw3G7OPfx7I9YPHdccIyKU9
 r199MPdLdemy4L0Q6woaVso7tg8oW8pMxE565K9dL1YsWl5LitFottXc7St/hsw/bUNF+JbQe2l4p
 4/l3bioCa6WidHYMTeW8XkFhKDN1NNtDg712wNWDq7tU9VmbTQDMxwCrIobK2F9dEpkg3w7+8A6eM
 ZfhUbhy3UIoVlzCk60yn6EkQTrOv3nWUbk/jC+BFqUAWfSMt1y6yc859oaJ8PTwrF5bS4Cb0pQW3G
 L51yBtEjwaABEw==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:57962
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1ndtOm-0000cs-4o; Mon, 11 Apr 2022 08:44:04 -0400
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
References: <20220410134114.371-1-attila@HIDDEN>
 <20220410134114.371-2-attila@HIDDEN>
Date: Mon, 11 Apr 2022 14:44:02 +0200
In-Reply-To: <20220410134114.371-2-attila@HIDDEN> (Attila Lendvai's
 message of "Sun, 10 Apr 2022 15:41:14 +0200")
Message-ID: <87zgkriyct.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
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 (---)

Hi,

Attila Lendvai <attila@HIDDEN> skribis:

> * guix/http-client.scm (http-fetch): Use the right uri variable in case of
> redirection.
> ---
>  guix/http-client.scm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/guix/http-client.scm b/guix/http-client.scm
> index 8a5b3deecd..b8689a22ed 100644
> --- a/guix/http-client.scm
> +++ b/guix/http-client.scm
> @@ -148,7 +148,7 @@ (define uri*
>                              (or (not (uri-host uri))
>                                  (string=3D? host (uri-host uri)))
>                              port)
> -                       (open-connection uri*
> +                       (open-connection uri

Good catch!  This fixes <https://issues.guix.gnu.org/54609>.

Applied.

Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 1/2] http-client: Fix redirection.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Mon, 11 Apr 2022 12:46:02 +0000
Resent-Message-ID: <handler.54836.B54836.164968115316496 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Attila Lendvai <attila@HIDDEN>
Cc: 54836 <at> debbugs.gnu.org
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.164968115316496
          (code B ref 54836); Mon, 11 Apr 2022 12:46:02 +0000
Received: (at 54836) by debbugs.gnu.org; 11 Apr 2022 12:45:53 +0000
Received: from localhost ([127.0.0.1]:43030 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ndtQU-0004EQ-3N
	for submit <at> debbugs.gnu.org; Mon, 11 Apr 2022 08:45:53 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38254)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1ndtQS-000471-KN
 for 54836 <at> debbugs.gnu.org; Mon, 11 Apr 2022 08:45:49 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:36640)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1ndtQN-0000B2-AR; Mon, 11 Apr 2022 08:45:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=xcslo8tUTkNAjnWaZN9aPkeenDZqx1rBrK/SS8JzIT8=; b=qvbIyjBv4TO3oPG/8CVM
 vKpqMCrH/Fv6fFHlb7h9YmkPdrPuN8RRGEK8/sQ9UqvIMlwV4Ry+WOoehHWHrXWMkEj5VBQu7kho4
 zlsYCPd4PyzQRSN3gPkUszrnB+qQXJ8XgjJIxEkhDXhN99QRLv40fozUpiY+30Xw6Tq5ZfYynIyvb
 Q7An+TY53BBk095u7LRdFXI2Dzo+VmxkoAegGeJb9OQd0rHigr/Mbw9BR99bNZa7/qw1bRcT6X/2P
 iIm2ploJvdklNdXCR7UqX+ENr/1g2axxSjJpq4gAykIG4WfGAveqrbnXgvIKpxCbggSZdSqTRqMgj
 dHZYM9/kBijIUQ==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:57579
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1ndtQM-0000q2-Hk; Mon, 11 Apr 2022 08:45:43 -0400
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
References: <20220410133431.30058-1-attila@HIDDEN>
 <20220410134114.371-1-attila@HIDDEN>
Date: Mon, 11 Apr 2022 14:45:41 +0200
In-Reply-To: <20220410134114.371-1-attila@HIDDEN> (Attila Lendvai's
 message of "Sun, 10 Apr 2022 15:41:13 +0200")
Message-ID: <87v8vfiya2.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
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 (---)

Hi,

Attila Lendvai <attila@HIDDEN> skribis:

> This is needed when dealing with golang packages, as per:
> https://golang.org/ref/mod#vcs-find
>
> A page may return 404, but at the same time also contain the sought after
> `go-import` meta tag.  An example for such a project/page is:
> https://www.gonum.org/v1/gonum?go-get=3D1
>
> It's not enough to just handle the thrown exception, because we need to be
> able to get hold of the fetched content, too.

Would it make sense, then, to use the lower-level =E2=80=98http-get=E2=80=
=99 from (web
client)?  That would let the code deal with all the HTTP idiosyncrasies.

Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 1/2] http-client: Fix redirection.
Resent-From: Attila Lendvai <attila@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Tue, 12 Apr 2022 07:29:01 +0000
Resent-Message-ID: <handler.54836.B54836.164974852825862 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 54836 <at> debbugs.gnu.org
Reply-To: Attila Lendvai <attila@HIDDEN>
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.164974852825862
          (code B ref 54836); Tue, 12 Apr 2022 07:29:01 +0000
Received: (at 54836) by debbugs.gnu.org; 12 Apr 2022 07:28:48 +0000
Received: from localhost ([127.0.0.1]:47237 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1neAxE-0006j4-Cv
	for submit <at> debbugs.gnu.org; Tue, 12 Apr 2022 03:28:48 -0400
Received: from mail-40136.proton.ch ([185.70.40.136]:56273)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <attila@HIDDEN>) id 1neAxC-0006ia-1n
 for 54836 <at> debbugs.gnu.org; Tue, 12 Apr 2022 03:28:47 -0400
Date: Tue, 12 Apr 2022 07:28:33 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lendvai.name;
 s=protonmail3; t=1649748519;
 bh=df/2c/yy4OmkeO0XKQ8D6UCnrWLLfTIkeGCSjT4BlyM=;
 h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To:
 References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID;
 b=jym01A7azJZ99XB4c/h7OVb/m9+Vl3SR7u+M0G8E2WbqJNvi+OYUT5n4lzpRLv02c
 n1dTFhmJBw3iUEDbYp/Ewaq23+k7AkBqAzMZixiVXBEnTUI++v19/cg274m4K10MZx
 87uXtY2aRnQGPTHYwC/m1l/G+IARCOKXE8FIQDlvSPEEJ/2CppU4FyIguAiIihf1Zm
 +3cLUn2xRivRXJIY+39E6ZYp2PLPrIJfSXKmDqfA6Dqk4DpiQpyLiM6mOUVatxGnZL
 T355LiOyP7Y69Htb6l90bZTrzupVInA7hpu3SSqWK4yobt8WXr66azCVoBAcySFOjk
 oP9tmor4cHoqw==
From: Attila Lendvai <attila@HIDDEN>
Message-ID: <TEOfd1QUBofS5gzJHP15SC0Lq_iRfWnto0m99ZpFBNJYGIc41qK2tR79kaOhzZPSV_r-EYJdlDJ7Ib8rRO3OJYN_6wNtqTrPZvFwm-1i53E=@lendvai.name>
In-Reply-To: <87v8vfiya2.fsf_-_@HIDDEN>
References: <20220410133431.30058-1-attila@HIDDEN>
 <20220410134114.371-1-attila@HIDDEN> <87v8vfiya2.fsf_-_@HIDDEN>
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 <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 (-)

> > It's not enough to just handle the thrown exception, because we need to=
 be
> > able to get hold of the fetched content, too.
>
> Would it make sense, then, to use the lower-level =E2=80=98http-get=
=E2=80=99 from (web
> client)? That would let the code deal with all the HTTP idiosyncrasies.


i think it boils down to this trade-off:

1) keep http-fetch simpler, at the expense of reimplementing parts of
   it in the go importer (e.g. the redirection logic)

2) add this extra complexity to http-fetch, and avoid the extra
   complexity of a local, potentially half-assed %http-fetch in the go
   importer.

3) something else i'm not aware of

please advise how to reshape this patch/feature, because it's needed
to file my go importer patches.

--
=E2=80=A2 attila lendvai
=E2=80=A2 PGP: 963F 5D5F 45C7 DFCD 0A39
--
The use of power is only needed when you want to do something harmful, othe=
rwise love is enough to get everything done.





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 1/2] http-client: Fix redirection.
Resent-From: Attila Lendvai <attila@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 27 Apr 2022 16:39:02 +0000
Resent-Message-ID: <handler.54836.B54836.165107748412566 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 54836 <at> debbugs.gnu.org
Reply-To: Attila Lendvai <attila@HIDDEN>
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.165107748412566
          (code B ref 54836); Wed, 27 Apr 2022 16:39:02 +0000
Received: (at 54836) by debbugs.gnu.org; 27 Apr 2022 16:38:04 +0000
Received: from localhost ([127.0.0.1]:44062 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1njkg0-0003Gc-6X
	for submit <at> debbugs.gnu.org; Wed, 27 Apr 2022 12:38:04 -0400
Received: from mail-4018.proton.ch ([185.70.40.18]:37564)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <attila@HIDDEN>) id 1njkfy-0003G5-EE
 for 54836 <at> debbugs.gnu.org; Wed, 27 Apr 2022 12:38:02 -0400
Date: Wed, 27 Apr 2022 16:37:49 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lendvai.name;
 s=protonmail3; t=1651077476;
 bh=KqmwtZbfBjlP/qdIn4/o3TK4sM6Q1XwcCm8zClBYbK0=;
 h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To:
 References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To:
 Feedback-ID:Message-ID;
 b=Vf3c2z+GsiuD8tTzcqq2q6gg/Tz8W5yYqN7Oq5kAZIjl8UToCLF3uMhx+nVJpqUhu
 KxVboPdjSMg3n2XPtko09SMiKgwmzrI5b06y9jnGvXUI8j5znAcL15XcD7MfOCNeYP
 0QvsVbVknDMVQca3sTZVrvsR0xfarWjrw3rGSOaJth387iS0PJjSb/AbxZtICxfe8P
 w741lmotPJ1aFQWGJFsuOv3Jy+fjII46GLu/im8hMSuEbQs+Ts4HJlkiWfFendAcnm
 gHiyWH+aJaaBp2y6VgC/0DE9Rh3J2iDN03lJs5ep3d22t5NZIsEiGiaSBpRiVA2ZQD
 egj9glocT+mWw==
From: Attila Lendvai <attila@HIDDEN>
Message-ID: <T85_Nvw-LsLO7PH3chsQrAxbadvabr52b_En56SVdyZERm9P-7NbvA63h-eF-rUKePndSP99xYx5XfuTNu3UcmorvUS_yzFWTLLIVNMGt6M=@lendvai.name>
In-Reply-To: <TEOfd1QUBofS5gzJHP15SC0Lq_iRfWnto0m99ZpFBNJYGIc41qK2tR79kaOhzZPSV_r-EYJdlDJ7Ib8rRO3OJYN_6wNtqTrPZvFwm-1i53E=@lendvai.name>
References: <20220410133431.30058-1-attila@HIDDEN>
 <20220410134114.371-1-attila@HIDDEN> <87v8vfiya2.fsf_-_@HIDDEN>
 <TEOfd1QUBofS5gzJHP15SC0Lq_iRfWnto0m99ZpFBNJYGIc41qK2tR79kaOhzZPSV_r-EYJdlDJ7Ib8rRO3OJYN_6wNtqTrPZvFwm-1i53E=@lendvai.name>
Feedback-ID: 28384833:user:proton
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 <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 (-)

> i think it boils down to this trade-off:
>
> 1) keep http-fetch simpler, at the expense of reimplementing parts of
> it in the go importer (e.g. the redirection logic)
>
> 2) add this extra complexity to http-fetch, and avoid the extra
> complexity of a local, potentially half-assed %http-fetch in the go
> importer.
>
> 3) something else i'm not aware of
>
> please advise how to reshape this patch/feature, because it's needed
> to file my go importer patches.


can someone with authority please decide how to proceed with this?

(the reason is that i'd like to file my golang importer improvements
before it develops a painful merge conflict with master.)

--
=E2=80=A2 attila lendvai
=E2=80=A2 PGP: 963F 5D5F 45C7 DFCD 0A39
--
=E2=80=9CYour living is determined not so much by what life brings to you a=
s by the attitude you bring to life; not so much by what happens to you as =
by the way your mind looks at what happens.=E2=80=9D
=09=E2=80=94 Khalil Gibran (1883=E2=80=931931)





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 1/2] http-client: Fix redirection.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 27 Apr 2022 20:54:01 +0000
Resent-Message-ID: <handler.54836.B54836.165109281617878 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Attila Lendvai <attila@HIDDEN>
Cc: 54836 <at> debbugs.gnu.org
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.165109281617878
          (code B ref 54836); Wed, 27 Apr 2022 20:54:01 +0000
Received: (at 54836) by debbugs.gnu.org; 27 Apr 2022 20:53:36 +0000
Received: from localhost ([127.0.0.1]:44542 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1njofH-0004eI-UV
	for submit <at> debbugs.gnu.org; Wed, 27 Apr 2022 16:53:36 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56846)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1njofG-0004e2-Ti
 for 54836 <at> debbugs.gnu.org; Wed, 27 Apr 2022 16:53:35 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:36938)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1njofB-0006Yj-Bw; Wed, 27 Apr 2022 16:53:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=eMkkihghH6gEqGUG16RKbUl6oln8nU9w9OKvJhSWHbw=; b=Sml2nnXU+podjtIHitTH
 FNfwN0VA8oRzxlbvuv38Q1iLEIK8/IiRhcGvtx26MSLSU60zgQlfzaNYpfZfehfIS4zni7sm11osB
 cHRUV9n6mvMPNDQBwPofnljcZerSGhegR9varP3zOC0UNoeuxBvEbHSM/IsPRC6M8hHQ5dwThTUMf
 ppGzkdWjcuVFcmIiW3ZfxFyrYGZ+bbESsGxi7+LXVvgCjdbdkCdqPFlBkccNA3egfemElk8rmtbzp
 iCkJWFA3OIhzUDDGVZ4fO1wVSuEfXL3Ozitn7fOUXbAEfSfg6K5vEHVreQzqZwYkX8IGnXjicHBbz
 ZibOZMljOGIy4Q==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55179
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1njofA-0004QD-Vw; Wed, 27 Apr 2022 16:53:29 -0400
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
References: <20220410133431.30058-1-attila@HIDDEN>
 <20220410134114.371-1-attila@HIDDEN> <87v8vfiya2.fsf_-_@HIDDEN>
 <TEOfd1QUBofS5gzJHP15SC0Lq_iRfWnto0m99ZpFBNJYGIc41qK2tR79kaOhzZPSV_r-EYJdlDJ7Ib8rRO3OJYN_6wNtqTrPZvFwm-1i53E=@lendvai.name>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 8 =?UTF-8?Q?Flor=C3=A9al?= an 230 de la =?UTF-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Wed, 27 Apr 2022 22:53:26 +0200
In-Reply-To: <TEOfd1QUBofS5gzJHP15SC0Lq_iRfWnto0m99ZpFBNJYGIc41qK2tR79kaOhzZPSV_r-EYJdlDJ7Ib8rRO3OJYN_6wNtqTrPZvFwm-1i53E=@lendvai.name>
 (Attila Lendvai's message of "Tue, 12 Apr 2022 07:28:33 +0000")
Message-ID: <8735hyjlix.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
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 (---)

Hi,

And sorry for the delay.

Attila Lendvai <attila@HIDDEN> skribis:

>> > It's not enough to just handle the thrown exception, because we need t=
o be
>> > able to get hold of the fetched content, too.
>>
>> Would it make sense, then, to use the lower-level =E2=80=98http-get=E2=
=80=99 from (web
>> client)? That would let the code deal with all the HTTP idiosyncrasies.
>
>
> i think it boils down to this trade-off:
>
> 1) keep http-fetch simpler, at the expense of reimplementing parts of
>    it in the go importer (e.g. the redirection logic)
>
> 2) add this extra complexity to http-fetch, and avoid the extra
>    complexity of a local, potentially half-assed %http-fetch in the go
>    importer.
>
> 3) something else i'm not aware of

For now, I=E2=80=99m somewhat in favor of #1.

My take would be: try to implement whatever=E2=80=99s needed specifically f=
or
the Go importer; from there, we can eventually revisit that situation
and maybe switch to something that=E2=80=99s more like #2.

How does that sound?

Thanks,
Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH v3] http-client: Factor out open-connection*, rename variables.
References: <20220410133431.30058-1-attila@HIDDEN>
In-Reply-To: <20220410133431.30058-1-attila@HIDDEN>
Resent-From: Attila Lendvai <attila@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 28 Apr 2022 10:27:02 +0000
Resent-Message-ID: <handler.54836.B54836.165114159121580 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 54836 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila@HIDDEN>
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.165114159121580
          (code B ref 54836); Thu, 28 Apr 2022 10:27:02 +0000
Received: (at 54836) by debbugs.gnu.org; 28 Apr 2022 10:26:31 +0000
Received: from localhost ([127.0.0.1]:45459 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nk1Ly-0005c0-UP
	for submit <at> debbugs.gnu.org; Thu, 28 Apr 2022 06:26:31 -0400
Received: from mail-ej1-f52.google.com ([209.85.218.52]:38536)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <attila.lendvai@HIDDEN>) id 1nk1Lw-0005bj-L5
 for 54836 <at> debbugs.gnu.org; Thu, 28 Apr 2022 06:26:29 -0400
Received: by mail-ej1-f52.google.com with SMTP id r13so8637756ejd.5
 for <54836 <at> debbugs.gnu.org>; Thu, 28 Apr 2022 03:26:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=zuH42bxUCGQfE/N8m73Ld5cYGlr8bKiTowntEZeMA/c=;
 b=dmu8hHa7z6LZbhA8N/ngyOLYZ4D2VFajpZDopovFFIObZDF0PLzu8z1CuJ/yiAZZWl
 HocwfFQfGPK8z5fnF9p/1VgrxtE15CALUV9Z+e3zsEukP90NHTG0fi2m+2V15ArzODKN
 4dMAM6ILVKkG2Clk7H+zhcR4bym8zLsuuF9ItNHsTpZNkmkudwebUHGxQ4QM4stp5wgw
 TWwKecqDX7Q56DMeol4qpwAYvnQMQ7DTLq9k25zDieLRJEqshV8+4KOb5q1AojUKHeib
 9sCW2MfX4ZTE4eNkryVq/Y9q8TO4rKypiZjZlkbaifh1SUs6zQ89hp38tWDDPXlMlU3j
 hBIw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:from:to:cc:subject:date:message-id
 :mime-version:content-transfer-encoding;
 bh=zuH42bxUCGQfE/N8m73Ld5cYGlr8bKiTowntEZeMA/c=;
 b=obn6tt+ukErqHfqElHIPEx1oI68idklZhcGb60mNQknHpnnYo8pZRsdt95PGbWn/ib
 Tbq4MAZ6q1wqjW8VoxStJrNxX9+xEgdD75LbiG1eo8GL3MRoQxBv1fZ3j9YSvulqD2+O
 FORQfo/4Qpw3TRyO4z6+fvFCy8oMfUpwwwA2sSCHtTimwDwJF9UVsonbiPzOtLbqBWwy
 8fxfUSV/ebwfeT8jUkKXLuakYSXsb9g+ToKe6D2WJ0lDmLLUa36LV24flOQobdIKlT5S
 Mce1/1tkdZfD61R3EWAKPlKDl0dUmcuJisXHnMDtyJHURWJU796/8mcRD5tfbgmtLkC4
 9dwA==
X-Gm-Message-State: AOAM532Fw8TuUefqcaTgzZ0Cam0zzvQ+EVjUJZHDGlFjBQpGXuxZFzIJ
 ZHIkaWkSb/M4pciMlwZF7sSwbLlKrs8=
X-Google-Smtp-Source: ABdhPJzmnVdOoSmOpQY/niIA4+Zb7xlvnu/49S7t3EwNHzkDeKa++VquNQfCJp34woXTMGCQza0Crw==
X-Received: by 2002:a17:907:98eb:b0:6f3:ce56:c1a2 with SMTP id
 ke11-20020a17090798eb00b006f3ce56c1a2mr6740861ejc.173.1651141582668; 
 Thu, 28 Apr 2022 03:26:22 -0700 (PDT)
Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu.
 [89.132.245.188]) by smtp.gmail.com with ESMTPSA id
 v21-20020aa7d815000000b0042617ba63b8sm1313694edq.66.2022.04.28.03.26.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Apr 2022 03:26:22 -0700 (PDT)
From: Attila Lendvai <attila@HIDDEN>
Date: Thu, 28 Apr 2022 12:22:34 +0200
Message-Id: <20220428102233.14558-1-attila@HIDDEN>
X-Mailer: git-send-email 2.35.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.5 (/)
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: -0.5 (/)

This is an idempotent refactor.

* guix/http-client.scm (http-fetch): Introduce open-connection*. Rename some
variables to turn programmer mistakes into compile time errors.
---

v3: i have reordered the commits so that i can send this idempotent
refactor. i think this would be a useful addition to master. it makes
the code more defensive against future programmer mistakes, but
other than that it shouldn't change the semantics.

apply this as you see fit. the rest i'll do in the go importer's module.

 guix/http-client.scm | 66 ++++++++++++++++++++++----------------------
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/guix/http-client.scm b/guix/http-client.scm
index a367c41afa..6c61fd3d8e 100644
--- a/guix/http-client.scm
+++ b/guix/http-client.scm
@@ -100,15 +100,17 @@ (define* (http-fetch uri #:key port (text? #f) (buffered? #t)
 Write information about redirects to LOG-PORT.
 
 Raise an '&http-get-error' condition if downloading fails."
-  (define uri*
+  (define parsed-initial-uri
     (if (string? uri) (string->uri uri) uri))
 
-  (let loop ((uri uri*)
-             (port (or port (open-connection uri*
-                                             #:verify-certificate?
-                                             verify-certificate?
-                                             #:timeout timeout))))
-    (let ((headers (match (uri-userinfo uri)
+  (define (open-connection* uri)
+    (open-connection uri
+                     #:verify-certificate? verify-certificate?
+                     #:timeout timeout))
+
+  (let loop ((current-uri parsed-initial-uri)
+             (current-port (or port (open-connection parsed-initial-uri))))
+    (let ((headers (match (uri-userinfo current-uri)
                      ((? string? str)
                       (cons (cons 'Authorization
                                   (string-append "Basic "
@@ -116,10 +118,10 @@ (define uri*
                                                   (string->utf8 str))))
                             headers))
                      (_ headers))))
-      (unless (or buffered? (not (file-port? port)))
-        (setvbuf port 'none))
+      (unless (or buffered? (not (file-port? current-port)))
+        (setvbuf current-port 'none))
       (let*-values (((resp data)
-                     (http-get uri #:streaming? #t #:port port
+                     (http-get current-uri #:streaming? #t #:port current-port
                                #:keep-alive? keep-alive?
                                #:headers headers))
                     ((code)
@@ -132,36 +134,34 @@ (define uri*
             303                                   ; see other
             307                                   ; temporary redirection
             308)                                  ; permanent redirection
-           (let ((host (uri-host uri))
-                 (uri  (resolve-uri-reference (response-location resp) uri)))
+           (let ((host (uri-host current-uri))
+                 (new-uri (resolve-uri-reference (response-location resp)
+                                                 current-uri)))
              (if keep-alive?
                  (dump-port data (%make-void-port "w0")
                             (response-content-length resp))
-                 (close-port port))
+                 (close-port current-port))
              (format log-port (G_ "following redirection to `~a'...~%")
-                     (uri->string uri))
-             (loop uri
+                     (uri->string new-uri))
+             (loop new-uri
                    (or (and keep-alive?
-                            (or (not (uri-host uri))
-                                (string=? host (uri-host uri)))
-                            port)
-                       (open-connection uri
-                                        #:verify-certificate?
-                                        verify-certificate?
-                                        #:timeout timeout)))))
+                            (or (not (uri-host new-uri))
+                                (string=? host (uri-host new-uri)))
+                            current-port)
+                       (open-connection* new-uri)))))
           (else
            (raise (condition (&http-get-error
-                              (uri uri)
-                              (code code)
-                              (reason (response-reason-phrase resp))
-                              (headers (response-headers resp)))
-                             (&message
-                              (message
-                               (format
-                                #f
-                                (G_ "~a: HTTP download failed: ~a (~s)")
-                                (uri->string uri) code
-                                (response-reason-phrase resp))))))))))))
+                                  (uri current-uri)
+                                  (code code)
+                                  (reason (response-reason-phrase resp))
+                                  (headers (response-headers resp)))
+                                 (&message
+                                  (message
+                                   (format
+                                    #f
+                                    (G_ "~a: HTTP download failed: ~a (~s)")
+                                    (uri->string current-uri) code
+                                    (response-reason-phrase resp))))))))))))
 
 (define-syntax-rule (false-if-networking-error exp)
   "Return #f if EXP triggers a network related exception as can occur when
-- 
2.35.1





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#54836] [PATCH 1/2] http-client: Fix redirection.
Resent-From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Tue, 03 Jan 2023 22:30:02 +0000
Resent-Message-ID: <handler.54836.B54836.167278498330702 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 54836
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Attila Lendvai <attila@HIDDEN>
Cc: 54836 <at> debbugs.gnu.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Received: via spool by 54836-submit <at> debbugs.gnu.org id=B54836.167278498330702
          (code B ref 54836); Tue, 03 Jan 2023 22:30:02 +0000
Received: (at 54836) by debbugs.gnu.org; 3 Jan 2023 22:29:43 +0000
Received: from localhost ([127.0.0.1]:46990 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pCpmw-0007z7-Nj
	for submit <at> debbugs.gnu.org; Tue, 03 Jan 2023 17:29:43 -0500
Received: from mail-qt1-f172.google.com ([209.85.160.172]:45831)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pCpmu-0007yr-Fz
 for 54836 <at> debbugs.gnu.org; Tue, 03 Jan 2023 17:29:40 -0500
Received: by mail-qt1-f172.google.com with SMTP id h21so25715683qta.12
 for <54836 <at> debbugs.gnu.org>; Tue, 03 Jan 2023 14:29:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=h/D7/m4aR1Phfiz24Z4/PBoGcT5AX7MBxELLWoZLtIs=;
 b=cAQQBaL5+qoT1VSx8uNqC5WyV31v3fZ28GmxW+ATZeqoY7t7KSr1dtu5ZMALoCub0J
 hsyJTC7dsQ5dtyJqfo9cNacFKBTL5+ubAOqpi3IqA6bkm8lwgwnXawEuNuhazUWr1lrV
 zd5TDbLhoiuzphgf6w+E742pP6PgUdTJhfGKjAAPA5Dw+AeW+ixVOrU7FjR1dw5H91qz
 hBvzWa6Jbcmj6ztSVrXDolzveZYeQuCZEpkOtk7v31jlbS8lT5f9rlap2yTEafcEzwcR
 jbgHcvu8quhNKKfVWhMH64tPwqS4YDYMOwztl+G317bASaf9A5VrNYCVsGlmCmycaXWe
 gFbg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=h/D7/m4aR1Phfiz24Z4/PBoGcT5AX7MBxELLWoZLtIs=;
 b=WYZZAUVOtYMidLyhL+XAG2pvmn+HKSS+1aWXVbNtObPUK87u19m/aZ6x8g5uXfMZcW
 n/rWtx1AvIy8C/ctUu4DrRanaaDQSDFAbrgNolo9tUMokJie+ZXCGtqFZTvEKTtcuiMt
 5t5N0syozn3OtsJcd/d4Blyn4WCmuylnPI0IkJFkhU6y5pEOF7a1kFSsfBm344g6KWN9
 KHiA8irCXMLmRkv0QtgMrKfLWz1ta+PUriFfuY65o4OOC0YaL7mZowIFVSzyKsbfHq4B
 k1XSEpBTJ+k++NMrfY0j2KvZ4M3Ou+M4OF1iWBFk+KeeEsv/4/NtomeTTm59XA2vMwTO
 opgA==
X-Gm-Message-State: AFqh2kqLYuCMuk/awnw/YI0vPwvtf74zGmXeXLE/1GwPtn+Fts089Dxn
 MDWtD7MohYZvRoO7lvcOzRKIUVi/wKG6Jeoj
X-Google-Smtp-Source: AMrXdXtpQkTAibHL4WdK0NCRuB5Q/CgBnA2pgsny2Z0pbiUHb/BjOGBTxJvjL7OGyO8pQAghqIzHIg==
X-Received: by 2002:ac8:6a0e:0:b0:3a9:86c6:e27b with SMTP id
 t14-20020ac86a0e000000b003a986c6e27bmr54318580qtr.28.1672784974850; 
 Tue, 03 Jan 2023 14:29:34 -0800 (PST)
Received: from hurd (dsl-10-135-221.b2b2c.ca. [72.10.135.221])
 by smtp.gmail.com with ESMTPSA id
 g1-20020a05620a40c100b006f87d28ea3asm22880300qko.54.2023.01.03.14.29.34
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 03 Jan 2023 14:29:34 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
References: <20220410133431.30058-1-attila@HIDDEN>
 <20220410134114.371-1-attila@HIDDEN> <87v8vfiya2.fsf_-_@HIDDEN>
 <TEOfd1QUBofS5gzJHP15SC0Lq_iRfWnto0m99ZpFBNJYGIc41qK2tR79kaOhzZPSV_r-EYJdlDJ7Ib8rRO3OJYN_6wNtqTrPZvFwm-1i53E=@lendvai.name>
 <8735hyjlix.fsf@HIDDEN>
Date: Tue, 03 Jan 2023 17:29:33 -0500
In-Reply-To: <8735hyjlix.fsf@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Wed, 27 Apr 2022 22:53:26 +0200")
Message-ID: <87wn63xnea.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
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 <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 (-)

Hi Attila,

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hi,
>
> And sorry for the delay.
>
> Attila Lendvai <attila@HIDDEN> skribis:
>
>>> > It's not enough to just handle the thrown exception, because we need =
to be
>>> > able to get hold of the fetched content, too.
>>>
>>> Would it make sense, then, to use the lower-level =E2=80=98http-get=E2=
=80=99 from (web
>>> client)? That would let the code deal with all the HTTP idiosyncrasies.
>>
>>
>> i think it boils down to this trade-off:
>>
>> 1) keep http-fetch simpler, at the expense of reimplementing parts of
>>    it in the go importer (e.g. the redirection logic)
>>
>> 2) add this extra complexity to http-fetch, and avoid the extra
>>    complexity of a local, potentially half-assed %http-fetch in the go
>>    importer.
>>
>> 3) something else i'm not aware of
>
> For now, I=E2=80=99m somewhat in favor of #1.
>
> My take would be: try to implement whatever=E2=80=99s needed specifically=
 for
> the Go importer; from there, we can eventually revisit that situation
> and maybe switch to something that=E2=80=99s more like #2.
>
> How does that sound?

I think we're missing your reworked 1/3 patch here, taking into account the=
 above
feedback from Ludo.

--=20
Thanks,
Maxim




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 3 Jan 2023 22:29:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 03 17:29:47 2023
Received: from localhost ([127.0.0.1]:46993 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pCpn1-0007zN-2e
	for submit <at> debbugs.gnu.org; Tue, 03 Jan 2023 17:29:47 -0500
Received: from mail-qt1-f176.google.com ([209.85.160.176]:33614)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pCpmy-0007yz-T8
 for control <at> debbugs.gnu.org; Tue, 03 Jan 2023 17:29:45 -0500
Received: by mail-qt1-f176.google.com with SMTP id bp44so23123888qtb.0
 for <control <at> debbugs.gnu.org>; Tue, 03 Jan 2023 14:29:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=subject:from:to:message-id:date:from:to:cc:subject:date:message-id
 :reply-to; bh=Tom1v5uPWImM9bg61ucOy9RySyoIx+kWVQuWqiK59hk=;
 b=J5kGjTtjxxAu5GqBrHn2pH0KcNmnfkVeZEREdIWjkNKO+uIxY0y/Kai9jTJyVFWBVH
 2enmRnKLFjqPMyIgOBGI6XSmitB5COGcXEZNl5FNkFr/bZGDfbttoJbZyyg63u6Zu87/
 fPKBG8StpLxLWcUYnm0Kzq2Cc7tGa0CG4zDq3W5XulrX+2kOVO1FQtZRyewowZenQfl1
 ZBYuJVUirPKVRwP2iroeVxd1CSa7wKfwTRWK8FEXwt2KLPEgQ3Q7xCmaxOm2Yh97Zz0I
 CC3rD3Sha72kCYHTPHMtanJLVtm14W8syxpYlX8pXUKp/m1EratGTIXA1yvfmTDDOgqC
 laYw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=subject:from:to:message-id:date:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Tom1v5uPWImM9bg61ucOy9RySyoIx+kWVQuWqiK59hk=;
 b=uMAPzdYsUTBRNyjf+pawL/fH5VfaWiBx9HSKvYGPMChV9HdwJ6YETRpaz30VrxKD8U
 BMHkANk9lgUL/B2+tk7G+6TcnfcLDKK3lVMMkOvPQRp5GPKVIn336yZy1OxNDU7mLGdy
 1yH8RDLEozTUsgbyfRrJ961LciPqEeIUTxsfpAiJCURKgQsllJq3DJfuGHo5bys7SHtp
 k1JkSYqmuaJ8t2aEZkJ/xF9ME93CZmhG2LaID7Vwykl3muXU7RzLWTAKv2ZZZjJe8ecb
 WCM9GHVMcgAP6+kSmZoe0gn4LqFvl3c9QXemjbOwsJzPhjfkG3LLH1URcafFZIDB3gcM
 LuCw==
X-Gm-Message-State: AFqh2kpf+DfMWkfzKrXkv3dWuYBZebfFUygM71zs6B9llaccfBYMGDbq
 bB+C+0+LO695rYeb95Enq6NiWKcz3fSZUk4P
X-Google-Smtp-Source: AMrXdXvjCVkEpMDRevEcirg3UomeU5kSI7uHs7DAlHW3paVK12u18aI9a3wdzUjaq6kdvca+z7Ixyw==
X-Received: by 2002:a05:622a:5c17:b0:3a8:2dba:751e with SMTP id
 gd23-20020a05622a5c1700b003a82dba751emr73005059qtb.26.1672784979336; 
 Tue, 03 Jan 2023 14:29:39 -0800 (PST)
Received: from hurd (dsl-10-135-221.b2b2c.ca. [72.10.135.221])
 by smtp.gmail.com with ESMTPSA id
 fb25-20020a05622a481900b003a5430ee366sm18048433qtb.60.2023.01.03.14.29.38
 for <control <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 03 Jan 2023 14:29:39 -0800 (PST)
Date: Tue, 03 Jan 2023 17:29:38 -0500
Message-Id: <87v8lnxne5.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: control message for bug #54836
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
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 54836 + moreinfo
quit






Last modified: Tue, 3 Jan 2023 22:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.