From patchwork Mon Feb 7 09:06:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 37051 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DEF2827BBEA; Mon, 7 Feb 2022 09:51:36 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A9FDA27BBE9 for ; Mon, 7 Feb 2022 09:51:36 +0000 (GMT) Received: from localhost ([::1]:60012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nH0gJ-0005pg-Q3 for patchwork@mira.cbaines.net; Mon, 07 Feb 2022 04:51:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nH00A-00067r-VF for guix-patches@gnu.org; Mon, 07 Feb 2022 04:08:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47037) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nH009-0004JZ-TW for guix-patches@gnu.org; Mon, 07 Feb 2022 04:08:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nH009-0002uj-Ja; Mon, 07 Feb 2022 04:08:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53818] [PATCH v2 3/7] http-client: 'http-fetch/cached' accepts a string or a . Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: maximedevos@telenet.be, guix-patches@gnu.org Resent-Date: Mon, 07 Feb 2022 09:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53818 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53818@debbugs.gnu.org Cc: Maxime Devos X-Debbugs-Original-Xcc: Maxime Devos Received: via spool by 53818-submit@debbugs.gnu.org id=B53818.164422483911102 (code B ref 53818); Mon, 07 Feb 2022 09:08:01 +0000 Received: (at 53818) by debbugs.gnu.org; 7 Feb 2022 09:07:19 +0000 Received: from localhost ([127.0.0.1]:40920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGzzF-0002sZ-10 for submit@debbugs.gnu.org; Mon, 07 Feb 2022 04:07:19 -0500 Received: from h178-251-242-94.cust.a3fiber.se ([178.251.242.94]:55276 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGzzD-0002ri-9A for 53818@debbugs.gnu.org; Mon, 07 Feb 2022 04:07:03 -0500 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yoctocell.xyz; s=mail; t=1644224817; bh=H8jADRyKH0fzq5VeA6Xl0rjl0GKGDAUsZO7ia0nN2ho=; h=From:To:Subject:In-Reply-To:References:Date; b=AkBgueNoH55EJP3JJBosf3/c8DZfwgdKy65vWi4gTiZggYkPOsg6mjsiQWHB9iD2f X4FLDz/u2vIiJXL9fSMK1j8jpIO3Tb3olEICxkBuPxuk7apPFq6W+JMZAT3/xFtSwE P4w2ruk50kgZZKDbiN6YQ61fMBlm7EUHjZ4bdFUc= In-Reply-To: References: Message-Id: <00f4de4c2fddf25566c726dde4a7d52ee80f7f71.1644224421.git.public@yoctocell.xyz> Date: Mon, 07 Feb 2022 10:06:57 +0100 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches This is consistent with the 'http-fetch' procedure. * guix/http-client.scm (http-fetch/cached): The 'uri' argument can be a string or a record. --- guix/http-client.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guix/http-client.scm b/guix/http-client.scm index 058f09852f..08efdd5e47 100644 --- a/guix/http-client.scm +++ b/guix/http-client.scm @@ -297,7 +297,10 @@ (define* (http-fetch/cached uri #:key (ttl (%http-cache-ttl)) text? TIMEOUT specifies the timeout in seconds for connection establishment. Write information about redirects to LOG-PORT." - (let ((file (cache-file-for-uri uri))) + (let* ((uri (if (string? uri) + (string->uri uri) + uri)) + (file (cache-file-for-uri uri))) (define (update-cache cache-port) (define cache-time (and cache-port