From: Javier Martinez Canillas <javi...@redhat.com> There are two different HTTP drivers that can be used when requesting an HTTP resource: the efi/http that uses the EFI_HTTP_PROTOCOL and the http that uses GRUB's HTTP and TCP/IP implementation.
The efi/http driver appends a prefix that is defined in the variable http_path, but the http driver doesn't. So using this driver and attempting to fetch a resource using a relative path fails. Match the behavior of efi/http. Signed-off-by: Javier Martinez Canillas <javi...@redhat.com> Co-authored-by: Robbie Harwood <rharw...@redhat.com> Signed-off-by: Robbie Harwood <rharw...@redhat.com> --- grub-core/net/http.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c index f78adcd679..b044b324c5 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -16,6 +16,7 @@ * along with GRUB. If not, see <http://www.gnu.org/licenses/>. */ +#include <grub/env.h> #include <grub/misc.h> #include <grub/net/tcp.h> #include <grub/net/ip.h> @@ -508,13 +509,20 @@ http_open (struct grub_file *file, const char *filename) { grub_err_t err; struct http_data *data; + const char *http_path; data = grub_zalloc (sizeof (*data)); if (!data) return grub_errno; file->size = GRUB_FILE_SIZE_UNKNOWN; - data->filename = grub_strdup (filename); + /* If path is relative, prepend http_path */ + http_path = grub_env_get ("http_path"); + if (http_path && filename[0] != '/') + data->filename = grub_xasprintf ("%s/%s", http_path, filename); + else + data->filename = grub_strdup (filename); + if (!data->filename) { grub_free (data); -- 2.39.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel