Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jedK4-0004De-5i for mharc-grub-devel@gnu.org; Fri, 29 May 2020 07:37:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jedK3-0004DW-Bc for grub-devel@gnu.org; Fri, 29 May 2020 07:37:11 -0400 Received: from dibed.net-space.pl ([84.10.22.86]:51776) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:192) (Exim 4.90_1) (envelope-from ) id 1jedK2-0001RZ-Fl for grub-devel@gnu.org; Fri, 29 May 2020 07:37:11 -0400 Received: from router-fw.i.net-space.pl ([192.168.52.1]:45848 "EHLO tomti.i.net-space.pl") by router-fw-old.i.net-space.pl with ESMTP id S1954258AbgE2Lge (ORCPT ); Fri, 29 May 2020 13:36:34 +0200 X-Comment: RFC 2476 MSA function at dibed.net-space.pl logged sender identity as: dkiper Date: Fri, 29 May 2020 13:36:32 +0200 From: Daniel Kiper To: Javier Martinez Canillas Cc: Daniel Kiper , grub-devel@gnu.org, cjwatson@ubuntu.com, higgi1pt@gmail.com, fsf@martin-whitaker.me.uk, mailing-lists@martin-whitaker.me.uk, mjg59@srcf.ucam.org, olaf@aepfle.de, phcoder@gmail.com Subject: Re: [PATCH 2/6] net/http: Return an error on HTTP error responses Message-ID: <20200529113632.v3iffefupgbecony@tomti.i.net-space.pl> References: <20200525190215.16390-1-daniel.kiper@oracle.com> <20200525190215.16390-3-daniel.kiper@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Received-SPF: pass client-ip=84.10.22.86; envelope-from=dkiper@net-space.pl; helo=dibed.net-space.pl X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/29 07:35:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2020 11:37:11 -0000 On Thu, May 28, 2020 at 09:10:59AM +0200, Javier Martinez Canillas wrote: > On 5/25/20 9:02 PM, Daniel Kiper wrote: > > From: Olaf Hering > > > > A http transfer will hang if an error is returned. The error branch > > returns the value GRUB_ERR_NONE which is not expected by the caller. > > > > Signed-off-by: Olaf Hering > > Signed-off-by: Daniel Kiper > > --- > > grub-core/net/http.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/grub-core/net/http.c b/grub-core/net/http.c > > index b616cf40b..0d3da7501 100644 > > --- a/grub-core/net/http.c > > +++ b/grub-core/net/http.c > > @@ -118,14 +118,14 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) > > case 404: > > data->err = GRUB_ERR_FILE_NOT_FOUND; > > data->errmsg = grub_xasprintf (_("file `%s' not found"), data->filename); > > - return GRUB_ERR_NONE; > > + return GRUB_ERR_FILE_NOT_FOUND; > > default: > > data->err = GRUB_ERR_NET_UNKNOWN_ERROR; > > /* TRANSLATORS: GRUB HTTP code is pretty young. So even perfectly > > valid answers like 403 will trigger this very generic message. */ > > data->errmsg = grub_xasprintf (_("unsupported HTTP error %d: %s"), > > code, ptr); > > - return GRUB_ERR_NONE; > > + return GRUB_ERR_FILE_READ_ERROR; > > } > > data->first_line_recv = 1; > > return GRUB_ERR_NONE; > > > > There is one case that is still returning GRUB_ERR_NONE even when is taken as > an error and that is when the HTTP version != 1.1. Maybe fixing that as well? OK, I will take a look at it. Daniel