Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jeCh4-00089S-AK for mharc-grub-devel@gnu.org; Thu, 28 May 2020 03:11:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeCh1-00088N-TP for grub-devel@gnu.org; Thu, 28 May 2020 03:11:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:54295 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jeCh0-0003Qe-0P for grub-devel@gnu.org; Thu, 28 May 2020 03:11:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590649864; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=fcb/iOyNYtjX8NQJx9eniyE0NARzCKVFZ/1o/ab3OrQ=; b=Z3yYF6bsUJ2W15+2AZ+dKV9E0BylHC3yrdDmV7am/YYzBh9z+i6zzLD0Np4K7mz+Xy/s7F tctx+XgfecLi62LgRrZITvY6AZn6+IHbY+Xs19xNyFeHBsdy6L0ru2YgrE2K2gN2973p9P G/yyHq40B2GFVtCyLiIfRcRl5Dvv9/g= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-253-s6qmVBMHPeSxEFvlkJR2tg-1; Thu, 28 May 2020 03:11:02 -0400 X-MC-Unique: s6qmVBMHPeSxEFvlkJR2tg-1 Received: by mail-wr1-f70.google.com with SMTP id e1so9756977wrm.3 for ; Thu, 28 May 2020 00:11:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fcb/iOyNYtjX8NQJx9eniyE0NARzCKVFZ/1o/ab3OrQ=; b=nAYd2aiQQvrcmxCxULoY2nA5fjxWReKOUxN9ccAN/1yAjOa8kUjRUv/7k0nc4hXfTL M3SKLUZsGYBFsCh1igPOei9G7Wjgf6sRjCgdf+pD0dV+Aeu9Xqo7Dl3X11qI/QymCbq8 rnCgk3+oOMm8M5n9zfSS9htlsoDHm5rslzUmqEGGUTc2gYwPMMxzbe+SO10iyMzM/W1P zWFkRqXQ2jvozvGCzoavZpW9uTmD8KY9qygJW5kUbJe2cyLRJHCcgtZq0UCUqBjjEqij kI2MuEquXKH7d3TmULTgOWTL0S/78cyIni+kwZy0ngl07aLl7hdJIfoHOxGe+9fsndRD QEyw== X-Gm-Message-State: AOAM5306UdlA9s54WePwLSDgtkpbrZ/7eX8i8GFNgN6PPvrnZpX614F3 SeWqUksKyAgSwoaW6E6GPVlgSKNqS3O+nQEHPmFEeBEAGBEkEX8kvcVN3cKadqCgdIfu6sL90fs pdRc+W96AnVY= X-Received: by 2002:a5d:4a45:: with SMTP id v5mr2061636wrs.223.1590649861417; Thu, 28 May 2020 00:11:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLsvmVyLf0xtwoK/Q2Yqr6igdR3bWl/7GWfwHDsYeJbeJlU/8TiBdtg4sXea4hX7cfw8N5vg== X-Received: by 2002:a5d:4a45:: with SMTP id v5mr2061602wrs.223.1590649861189; Thu, 28 May 2020 00:11:01 -0700 (PDT) Received: from ?IPv6:2a01:c50f:ab80:6700:527f:85b3:5615:ff0b? ([2a01:c50f:ab80:6700:527f:85b3:5615:ff0b]) by smtp.gmail.com with ESMTPSA id t13sm5042607wrn.64.2020.05.28.00.11.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 May 2020 00:11:00 -0700 (PDT) Subject: Re: [PATCH 2/6] net/http: Return an error on HTTP error responses To: Daniel Kiper , grub-devel@gnu.org Cc: 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 References: <20200525190215.16390-1-daniel.kiper@oracle.com> <20200525190215.16390-3-daniel.kiper@oracle.com> From: Javier Martinez Canillas Message-ID: Date: Thu, 28 May 2020 09:10:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200525190215.16390-3-daniel.kiper@oracle.com> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=207.211.31.120; envelope-from=javierm@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/28 03:11:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Thu, 28 May 2020 07:11:08 -0000 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? Best regards, -- Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat