Allow non-default ports for HTTP requests

Add support for passing ports in HTTP requests. This takes the form of:
(http,serverip:portnum)/file
This commit is contained in:
Matthew Garrett 2016-01-07 17:27:15 -08:00
parent 297e11980b
commit 78db6bcf33
3 changed files with 16 additions and 3 deletions

View file

@ -309,7 +309,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
{
http_data_t data = file->data;
grub_uint8_t *ptr;
int i;
int i, port;
struct grub_net_buff *nb;
grub_err_t err;
@ -391,8 +391,12 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
grub_netbuff_put (nb, 2);
grub_memcpy (ptr, "\r\n", 2);
if (file->device->net->port)
port = file->device->net->port;
else
port = HTTP_PORT;
data->sock = grub_net_tcp_open (file->device->net->server,
HTTP_PORT, http_receive,
port, http_receive,
http_err, http_err,
file);
if (!data->sock)