mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-27 01:29:27 +00:00
Revert "net/http: Allow use of non-standard TCP/IP ports"
The notation introduced inac8a37dda(net/http: Allow use of non-standard TCP/IP ports) contradicts that used in downstream distributions including Fedora, RHEL, Debian, Ubuntu, and others. Revert it and apply the downstream notation which was originally proposed to the GRUB in 2016. This reverts commitac8a37dda(net/http: Allow use of non-standard TCP/IP ports). Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
830456a6e3
commit
52061b2cf4
2 files changed
+2
-71
No files matched your search
+2
-38
@@ -318,10 +318,6 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
||||
int i;
|
||||
struct grub_net_buff *nb;
|
||||
grub_err_t err;
|
||||
char *server_name;
|
||||
char *port_string;
|
||||
const char *port_string_end;
|
||||
unsigned long port_number;
|
||||
|
||||
nb = grub_netbuff_alloc (GRUB_NET_TCP_RESERVE_SIZE
|
||||
+ sizeof ("GET ") - 1
|
||||
@@ -400,42 +396,10 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
||||
grub_netbuff_put (nb, 2);
|
||||
grub_memcpy (ptr, "\r\n", 2);
|
||||
|
||||
port_string = grub_strrchr (file->device->net->server, ',');
|
||||
if (port_string == NULL)
|
||||
{
|
||||
/* If ",port" is not found in the http server string, look for ":port". */
|
||||
port_string = grub_strrchr (file->device->net->server, ':');
|
||||
/* For IPv6 addresses, the ":port" syntax is not supported and ",port" must be used. */
|
||||
if (port_string != NULL && grub_strchr (file->device->net->server, ':') != port_string)
|
||||
port_string = NULL;
|
||||
}
|
||||
if (port_string != NULL)
|
||||
{
|
||||
port_number = grub_strtoul (port_string + 1, &port_string_end, 10);
|
||||
if (*(port_string + 1) == '\0' || *port_string_end != '\0')
|
||||
return grub_error (GRUB_ERR_BAD_NUMBER, N_("non-numeric or invalid port number `%s'"), port_string + 1);
|
||||
if (port_number == 0 || port_number > 65535)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("port number `%s' not in the range of 1 to 65535"), port_string + 1);
|
||||
|
||||
server_name = grub_strdup (file->device->net->server);
|
||||
if (server_name == NULL)
|
||||
return grub_errno;
|
||||
server_name[port_string - file->device->net->server] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
port_number = HTTP_PORT;
|
||||
server_name = file->device->net->server;
|
||||
}
|
||||
|
||||
data->sock = grub_net_tcp_open (server_name,
|
||||
port_number, http_receive,
|
||||
data->sock = grub_net_tcp_open (file->device->net->server,
|
||||
HTTP_PORT, http_receive,
|
||||
http_err, NULL,
|
||||
file);
|
||||
|
||||
if (server_name != file->device->net->server)
|
||||
grub_free (server_name);
|
||||
|
||||
if (!data->sock)
|
||||
{
|
||||
grub_netbuff_free (nb);
|
||||
|
||||
Reference in new issue
Block a user