[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/6] net/http: Return an error on HTTP error responses
From: |
Daniel Kiper |
Subject: |
Re: [PATCH 2/6] net/http: Return an error on HTTP error responses |
Date: |
Fri, 29 May 2020 13:36:32 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
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 <olaf@aepfle.de>
> >
> > 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 <olaf@aepfle.de>
> > Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
> > ---
> > 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
- [PATCH 0/6] GRUB: Bundle of various fixes and cleanups, Daniel Kiper, 2020/05/25
- [PATCH 2/6] net/http: Return an error on HTTP error responses, Daniel Kiper, 2020/05/25
- [PATCH 6/6] efi/tpm: Fix typo in grub_efi_tpm2_protocol struct, Daniel Kiper, 2020/05/25
- [PATCH 4/6] tpm: Drop unneeded code, Daniel Kiper, 2020/05/25
- [PATCH 1/6] grub-install: Fix inverted test for NLS enabled when copying locales, Daniel Kiper, 2020/05/25
- [PATCH 3/6] docs: Fix devicetree command description, Daniel Kiper, 2020/05/25
- [PATCH 5/6] i386/efi/init: Drop bogus include, Daniel Kiper, 2020/05/25