grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/6] net/http: Return an error on HTTP error responses


From: Daniel Kiper
Subject: [PATCH 2/6] net/http: Return an error on HTTP error responses
Date: Mon, 25 May 2020 21:02:11 +0200

From: Olaf Hering <address@hidden>

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 <address@hidden>
Signed-off-by: Daniel Kiper <address@hidden>
---
 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;
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]