http: return error on unhandled HTTP error responses
PATCH 1/1 http: return error on unhandled HTTP error responses
A http transfer will hang if an unhandled error is returned.
The error branch returns the value zero, which is not expected by the caller.
--- grub-core/net/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/net/http.c +1 -1
@@ -125,7 +125,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)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 ;
Quoted 13 lines · Olaf Hering
A http transfer will hang if an unhandled error is returned.
The error branch returns the value zero, which is not expected by the caller.Signed-off-by Olaf Hering <[email protected]>--- grub-core/net/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/net/http.c +0
-0
grub-core/net/http.c parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) · line 128
Quoted 5 lines
grub-core/net/http.c +1
-1@@ -125,7 +125,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)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 ;
Should not we do the same for 404, file not found, a few lines above?
Daniel
Am Wed, 25 Mar 2020 19:55:47 +0100
schrieb Daniel Kiper <[email protected]>:
Quoted 1 line
Should not we do the same for 404, file not found, a few lines above?
Maybe. For some reason a 404 returns quickly, while a 400 will request the file 4 times. With this patch there is still some delay, but the request is sent just once. I wonder what the author had in mind, where the error/state is actually supposed to be checked.
Olaf
Quoted 9 lines · Olaf Hering
Am Wed, 25 Mar 2020 19:55:47 +0100
schrieb Daniel Kiper <[email protected]>:Quoted 1 line
Should not we do the same for 404, file not found, a few lines above?
Maybe. For some reason a 404 returns quickly, while a 400 will request the file 4 times. With this patch there is still some delay, but the request is sent just once. I wonder what the author had in mind, where the error/state is actually supposed to be checked.
May I ask you to do the change for 404 and test it too? If it works please post a new patch.
Daniel
Quoted 6 lines · Daniel Kiper
Quoted 5 lines · Olaf Hering
Am Wed, 25 Mar 2020 19:55:47 +0100
schrieb Daniel Kiper <[email protected]>:Quoted 1 line
Should not we do the same for 404, file not found, a few lines above?
Quoted 7 lines
Quoted 4 lines
Maybe. For some reason a 404 returns quickly, while a 400 will request the file 4 times. With this patch there is still some delay, but the request is sent just once. I wonder what the author had in mind, where the error/state is actually supposed to be checked.
May I ask you to do the change for 404 and test it too? If it works please post a new patch.
Ping?
Daniel
Am Thu, 26 Mar 2020 20:36:47 +0100
schrieb Daniel Kiper <[email protected]>:
Quoted 2 lines
May I ask you to do the change for 404 and test it too? If it works please post a new patch.
I think "http" needs more surgery. It happens to work despite the (apparently) bogus error handling. But I do not have time to work on this now.
Olaf