From patchwork Thu Mar 3 21:14:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 37599 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 4A74A27BBEB; Thu, 3 Mar 2022 21:29:27 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 02F0A27BBEA for ; Thu, 3 Mar 2022 21:29:27 +0000 (GMT) Received: from localhost ([::1]:58940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPt0o-0008VP-5Q for patchwork@mira.cbaines.net; Thu, 03 Mar 2022 16:29:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPsnv-0005ey-5l for guix-patches@gnu.org; Thu, 03 Mar 2022 16:16:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:50053) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPsnq-0007Ii-Mk for guix-patches@gnu.org; Thu, 03 Mar 2022 16:16:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nPsnq-0002HI-HB for guix-patches@gnu.org; Thu, 03 Mar 2022 16:16:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54241] [PATCH 1/4] http-client: Add response headers to '&http-get-error'. References: <20220303211326.19884-1-ludo@gnu.org> In-Reply-To: <20220303211326.19884-1-ludo@gnu.org> Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 03 Mar 2022 21:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54241 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54241@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 54241-submit@debbugs.gnu.org id=B54241.16463421258666 (code B ref 54241); Thu, 03 Mar 2022 21:16:02 +0000 Received: (at 54241) by debbugs.gnu.org; 3 Mar 2022 21:15:25 +0000 Received: from localhost ([127.0.0.1]:43939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPsnE-0002Fd-TF for submit@debbugs.gnu.org; Thu, 03 Mar 2022 16:15:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57758) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPsnC-0002FM-RT for 54241@debbugs.gnu.org; Thu, 03 Mar 2022 16:15:24 -0500 Received: from [2001:470:142:3::e] (port=58918 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPsn7-00078m-LD; Thu, 03 Mar 2022 16:15:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=KbRkngTko0T7lcr8FWw0zRyzmJMdgMzzPqVooLXmPlE=; b=YDFscPTLrHTpBE 9GNIhs2cpaE0s2coo40j0IlBRQtLyFSPtFl0kuihbGYOYp55Ra03VuGpNSKN2zqgv195D+7qBTdCr Jsb5PffUBKHPthZ8fj2eyBIGCUgh/D/Ag9LloCqGk2WtSfmaHzuZPb603sZ9Fey8dq7rN3pZ0B+D9 JXiva/E4vFJX+J5/+6YF54+WFgwG2Cj99xh2nZu2k94zabYwDhNYHAoHVJPdgARGgbDIz/pFWuzBs XD5nnP9VTREpUiHbWGwS8/6fYrTD6EKqYfkcSp8nYPAUAwCFWR1lQCtAW3bOk2YzLZeN5/QeKsXFQ lv3bI2DWFq0g7o/LZhzg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:50082 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPsmu-0006KA-Tf; Thu, 03 Mar 2022 16:15:16 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 3 Mar 2022 22:14:41 +0100 Message-Id: <20220303211444.19928-1-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 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 * guix/http-client.scm (&http-get-error)[headers]: New field. (http-fetch): Initialize the 'headers' field. --- guix/http-client.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/guix/http-client.scm b/guix/http-client.scm index 10bc278023..4b01e31165 100644 --- a/guix/http-client.scm +++ b/guix/http-client.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2020, 2021 Ludovic Courtès +;;; Copyright © 2012-2018, 2020-2022 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2012, 2015 Free Software Foundation, Inc. ;;; Copyright © 2017 Tobias Geerinckx-Rice @@ -52,6 +52,7 @@ (define-module (guix http-client) http-get-error-uri http-get-error-code http-get-error-reason + http-get-error-headers http-fetch http-multiple-get @@ -69,9 +70,10 @@ (define-module (guix http-client) ;; HTTP GET error. (define-condition-type &http-get-error &error http-get-error? - (uri http-get-error-uri) ; URI - (code http-get-error-code) ; integer - (reason http-get-error-reason)) ; string + (uri http-get-error-uri) ;URI + (code http-get-error-code) ;integer + (reason http-get-error-reason) ;string + (headers http-get-error-headers)) ;alist (define* (http-fetch uri #:key port (text? #f) (buffered? #t) @@ -138,7 +140,8 @@ (define* (http-fetch uri #:key port (text? #f) (buffered? #t) (raise (condition (&http-get-error (uri uri) (code code) - (reason (response-reason-phrase resp))) + (reason (response-reason-phrase resp)) + (headers (response-headers resp))) (&message (message (format