From unknown Sun Jun 22 00:42:37 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#49483] [PATCH 2/3] substitutes: Properly construct URLs. Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Jul 2021 08:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49483 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 44906@debbugs.gnu.org, 49483@debbugs.gnu.org X-Debbugs-Original-To: 44906@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16258199382647 (code B ref -1); Fri, 09 Jul 2021 08:39:02 +0000 Received: (at submit) by debbugs.gnu.org; 9 Jul 2021 08:38:58 +0000 Received: from localhost ([127.0.0.1]:58321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1m2E-0000gc-I3 for submit@debbugs.gnu.org; Fri, 09 Jul 2021 04:38:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:48652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1m2B-0000gG-NA for submit@debbugs.gnu.org; Fri, 09 Jul 2021 04:38:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1m2B-0000G4-Dh for guix-patches@gnu.org; Fri, 09 Jul 2021 04:38:55 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:40372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1m29-0005ni-RC for guix-patches@gnu.org; Fri, 09 Jul 2021 04:38:55 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4GLmlw09CHz1qtd6; Fri, 9 Jul 2021 10:38:52 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4GLmlw04Ftz1qr4R; Fri, 9 Jul 2021 10:38:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 23ZFgpiZUpLp; Fri, 9 Jul 2021 10:38:51 +0200 (CEST) Received: from hermia.goebel-consult.de (ppp-188-174-58-132.dynamic.mnet-online.de [188.174.58.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Fri, 9 Jul 2021 10:38:51 +0200 (CEST) Received: from thisbe.goebel-consult.de (hermia.goebel-consult.de [192.168.110.7]) by hermia.goebel-consult.de (Postfix) with ESMTP id 67A3A601D6; Fri, 9 Jul 2021 10:38:46 +0200 (CEST) From: Hartmut Goebel Date: Fri, 9 Jul 2021 10:38:39 +0200 Message-Id: <26c8bb31c4d468e770e35cd743aca736f5ccd093.1625819848.git.h.goebel@crazy-compilers.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=212.18.0.9; envelope-from=h.goebel@crazy-compilers.com; helo=mail-out.m-online.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) 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 (---) Use relative URIs and "resolve-uri-reference" (which implements the algorithm specified in RFC 3986 section 5.2.2) for building the URL, instead of just appending strings. This avoids issued if the cache-url ends with a slash. * guix/substitutes.scm (narinfo-request): Use resolve-uri-reference for constructing the url. --- guix/substitutes.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/guix/substitutes.scm b/guix/substitutes.scm index 4987cda165..a5c554acff 100644 --- a/guix/substitutes.scm +++ b/guix/substitutes.scm @@ -37,7 +37,8 @@ #:use-module ((guix build utils) #:select (mkdir-p dump-port)) #:use-module ((guix build download) #:select ((open-connection-for-uri - . guix:open-connection-for-uri))) + . guix:open-connection-for-uri) + resolve-uri-reference)) #:use-module (guix progress) #:use-module (ice-9 rdelim) #:use-module (ice-9 regex) @@ -155,10 +156,12 @@ indicates that PATH is unavailable at CACHE-URL." (define (narinfo-request cache-url path) "Return an HTTP request for the narinfo of PATH at CACHE-URL." - (let ((url (string-append cache-url "/" (store-path-hash-part path) - ".narinfo")) - (headers '((User-Agent . "GNU Guile")))) - (build-request (string->uri url) #:method 'GET #:headers headers))) + (let* ((base (string->uri cache-url)) + (ref (build-relative-ref + #:path (string-append (store-path-hash-part path) ".narinfo"))) + (url (resolve-uri-reference ref base)) + (headers '((User-Agent . "GNU Guile")))) + (build-request url #:method 'GET #:headers headers))) (define (narinfo-from-file file url) "Attempt to read a narinfo from FILE, using URL as the cache URL. Return #f -- 2.30.2 From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 16 14:01:41 2021 Received: (at control) by debbugs.gnu.org; 16 Jul 2021 18:01:41 +0000 Received: from localhost ([127.0.0.1]:52297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4S9c-0007a0-QR for submit@debbugs.gnu.org; Fri, 16 Jul 2021 14:01:40 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:41019) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4S9a-0007Xl-J3 for control@debbugs.gnu.org; Fri, 16 Jul 2021 14:01:38 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4GRJw20bg5z1qtxd for ; Fri, 16 Jul 2021 20:01:38 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4GRJw20Vp0z1qqkH for ; Fri, 16 Jul 2021 20:01:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id GuYshdXKUtN5 for ; Fri, 16 Jul 2021 20:01:37 +0200 (CEST) Received: from hermia.goebel-consult.de (ppp-188-174-58-97.dynamic.mnet-online.de [188.174.58.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS for ; Fri, 16 Jul 2021 20:01:37 +0200 (CEST) Received: from thisbe.goebel-consult.de (hermia.goebel-consult.de [192.168.110.7]) by hermia.goebel-consult.de (Postfix) with ESMTP id 78F0C6014D for ; Fri, 16 Jul 2021 20:01:49 +0200 (CEST) To: control From: Hartmut Goebel Subject: close Organization: Goebel Consult Message-ID: <70ff8106-955c-ccd8-e9cc-a054c3391791@goebel-consult.de> Date: Fri, 16 Jul 2021 20:01:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: de-DE X-Spam-Score: -0.7 (/) 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.7 (-) close 49483 close 49482