From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id FY2lKpFqX2DfvwAAgWs5BA (envelope-from ) for ; Sat, 27 Mar 2021 18:25:37 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gJ+AI5FqX2A4XQAAB5/wlQ (envelope-from ) for ; Sat, 27 Mar 2021 17:25:37 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 22B4E2056B for ; Sat, 27 Mar 2021 18:25:37 +0100 (CET) Received: from localhost ([::1]:42878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQCgq-0003n7-3W for larch@yhetil.org; Sat, 27 Mar 2021 13:25:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQCXa-0002Re-Dw for guix-patches@gnu.org; Sat, 27 Mar 2021 13:16:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33301) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lQCXZ-0002Cs-Tc for guix-patches@gnu.org; Sat, 27 Mar 2021 13:16:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lQCXZ-0001bj-PS for guix-patches@gnu.org; Sat, 27 Mar 2021 13:16:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47288] [PATCH] guix: http-client: Tweak http-multiple-get error handling. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 27 Mar 2021 17:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47288 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 47288@debbugs.gnu.org Received: via spool by 47288-submit@debbugs.gnu.org id=B47288.16168653546163 (code B ref 47288); Sat, 27 Mar 2021 17:16:01 +0000 Received: (at 47288) by debbugs.gnu.org; 27 Mar 2021 17:15:54 +0000 Received: from localhost ([127.0.0.1]:44847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lQCXS-0001bL-Co for submit@debbugs.gnu.org; Sat, 27 Mar 2021 13:15:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lQCXP-0001b5-QO for 47288@debbugs.gnu.org; Sat, 27 Mar 2021 13:15:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39410) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQCXK-00023y-Cu; Sat, 27 Mar 2021 13:15:46 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=41816 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lQCXJ-0003le-GR; Sat, 27 Mar 2021 13:15:45 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20210321004338.31867-1-mail@cbaines.net> <20210325110316.862-1-mail@cbaines.net> <87r1k250za.fsf_-_@gnu.org> <87h7ky9ulu.fsf@cbaines.net> Date: Sat, 27 Mar 2021 18:15:42 +0100 In-Reply-To: <87h7ky9ulu.fsf@cbaines.net> (Christopher Baines's message of "Fri, 26 Mar 2021 08:39:41 +0000") Message-ID: <87mtuozfep.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616865937; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=yElzcSn4N1EY+hXHczyO+5KU5h23OjdaYTnDGokekfQ=; b=Fzq7Z/sHEa+zjQIma5HfRaR64jocZYOVCDBHTPAqQEky56iImBOvUQ23MZBHAzSR59mRjz NO756PiK9BXVL3LL9yuGQW60vA70rkM0WroI1B3HYGWk02AFfGQwqSCKAXe1W0jouyp4OM oHuDrJyWXOZbCd9XiREpPZEIxQsHDr3HcdG/yyZhRIH0XHxgeHLl0rapf5zBnNnxLHXVqz SYyJFMevk+yPFytg4jX32NIvwV0XIJo2NiYPN/+P1rzoebsA3RAijekAhUc1piyuIEF+IL w/dVrL6S1ufvMarvEJinIIXOZD8SCz2NLBAPEIFXdomiV+thmKC+mW3dAKH2+A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616865937; a=rsa-sha256; cv=none; b=SpxHvdPwMHey0blvkOMpuyraYwJsS8CipHpdDXYfqczCO++a9NNtcEnO9wJLLuzrHpXrxd AJ4t/56JThGaRNmbJtN7mPpBDPUztXK4tm+vBhUisvs0BV+N8kB4RAehs3Oa+sGGaUJskg cgzmyVT8uMlKfgjPnTVoOpKWy34flt61YnG0BIDrojv5iP3zbGJVLcxrnHA9SNELdNrX2T tJMSGSC/6M1etY7juofyK0vpLfZqDtV7/xKnmfXPViFSLCUp5dYst4kpN12ixJ5D1/JPDF QIjOcYVx0uc49t3+/n39h6Ev4XUIUhCEBoey2pvJNmiPN45nRGm6oABG0wqzgA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.92 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 22B4E2056B X-Spam-Score: -2.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: JXv5DhgTAW7D Hi, Christopher Baines skribis: > Ludovic Court=C3=A8s writes: [...] >> + (match (false-if-networking-error (read-response p)) >> + ((? response? resp) >> + (let* ((body (response-body-port resp)) >> + (result (proc head resp body result))) > > Given body is a port, and that port is passed to proc, I'm guessing it's > possible for networking things to go wrong inside proc. Yes, but how is this different from a regular read(2) call as made by =E2=80=98get-bytevector-n=E2=80=99 or whatever? We wouldn=E2=80=99t write = every read(2) call in =E2=80=98catch=E2=80=99 because in general any error there is indeed except= ional. I think the only bit that=E2=80=99s =E2=80=9Cless exceptional=E2=80=9D here= is that, because we=E2=80=99re reusing cached connection, we know that the first read(2) or = the first write(2) to that port can trigger one of these errors=E2=80=94which, = we know are not =E2=80=9Cexceptional=E2=80=9D. Errors in subsequent read(2) o= r write(2) calls remain exceptional/unrecoverable and should be treated as such IMO. Does that make sense? (In that sense, I think wrapping every =E2=80=98read-response=E2=80=99 call= rather than just the first one is already too much, but that=E2=80=99s okay.) >> + ;; The server can choose to stop responding at any time, >> + ;; in which case we have to try again. Check whether >> + ;; that is the case. Note that even upon "Connection: >> + ;; close", we can read from BODY. >> + (match (assq 'connection (response-headers resp)) >> + (('connection 'close) >> + (close-port p) >> + (connect #f ;try again >> + (drop requests (+ 1 processed)) >> + result)) >> + (_ >> + (loop tail (+ 1 processed) result))))) >> + (#f >> + (close-port p) >> + (connect #f ; try again >> + (drop requests (+ 1 processed)) > > I realised earlier in this series of patches that this should actually > be processed, rather than (+ 1 processed) since proc can't have been run > for the current response. Oh, something to fix in a subsequent commit, then. All in all, I propose to go with this patch if that=E2=80=99s fine with you. Thanks! Ludo=E2=80=99.