[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: |
Javier Martinez Canillas |
Subject: |
Re: [PATCH 2/6] net/http: Return an error on HTTP error responses |
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 |
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?
Best regards,
--
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat
- [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
- Re: [PATCH 2/6] net/http: Return an error on HTTP error responses,
Javier Martinez Canillas <=
- [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