Skip to contentSkip to conversation

lwip: wget: pass port and server_name via wget_ctx

PATCH In review Adriano Cordova 2 participants 2 messages Dec 3, 2024 Networking

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 lwip: wget: pass port and server_name via wget_ctx

Commit 5907c81 ("net: lwip: Enable https:// support for wget") was not correctly rebased on top of the changes introduced by Commit 6cc4d04 ("net/lwip: wget: put server_name and port into wget_ctx") in next. This commit re-applies a couple of lines from 6cc4d04.

Fixes Commit 5907c81 ("net: lwip: Enable https:// support for wget")

---
Changes in v3: there was still another server_name to be replaced by ctx.server_name Changes in v2: changed commit name

 net/lwip/wget.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/lwip/wget.c +2 -4
index af48d741a4..3d02f26c09 100644
@@ -288,7 +288,6 @@ static err_t httpc_headers_done_cb(httpc_state_t *connection, void *arg, struct
 
 static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
 {
-	char server_name[SERVER_NAME_SIZE];
 #if defined CONFIG_WGET_HTTPS
 	altcp_allocator_t tls_allocator;
 #endif
@@ -297,7 +296,6 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
 	struct netif *netif;
 	struct wget_ctx ctx;
 	char *path;
-	u16 port;
 	bool is_https;
 
 	ctx.daddr = dst_addr;
@@ -307,7 +305,7 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
 	ctx.prevsize = 0;
 	ctx.start_time = 0;
 
-	if (parse_url(uri, server_name, &port, &path, &is_https))
+	if (parse_url(uri, ctx.server_name, &ctx.port, &path, &is_https))
 		return CMD_RET_USAGE;
 
 	netif = net_lwip_new_netif(udev);
@@ -319,7 +317,7 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
 	if (is_https) {
 		tls_allocator.alloc = &altcp_tls_alloc;
 		tls_allocator.arg =
-			altcp_tls_create_config_client(NULL, 0, server_name);
+			altcp_tls_create_config_client(NULL, 0, ctx.server_name);
 
 		if (!tls_allocator.arg) {
 			log_err("error: Cannot create a TLS connection\n");
Signature · 1 line
2.43.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 5 lines · Adriano Cordova

Commit 5907c81 ("net: lwip: Enable https:// support for wget") was not correctly rebased on top of the changes introduced by Commit 6cc4d04 ("net/lwip: wget: put server_name and port into wget_ctx") in next. This commit re-applies a couple of lines from 6cc4d04.

Quoted 8 lines
Fixes Commit 5907c81 ("net: lwip: Enable https:// support for wget")

---
Changes in v3: there was still another server_name to be replaced by ctx.server_name Changes in v2: changed commit name

 net/lwip/wget.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Thanks,

Signature · 1 line
Jerome
Quoted 38 lines
net/lwip/wget.c +2 -4
index af48d741a4..3d02f26c09 100644
@@ -288,7 +288,6 @@ static err_t httpc_headers_done_cb(httpc_state_t *connection, void *arg, struct
 
 static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
 {
-	char server_name[SERVER_NAME_SIZE];
 #if defined CONFIG_WGET_HTTPS
 	altcp_allocator_t tls_allocator;
 #endif
@@ -297,7 +296,6 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
 	struct netif *netif;
 	struct wget_ctx ctx;
 	char *path;
-	u16 port;
 	bool is_https;
 
 	ctx.daddr = dst_addr;
@@ -307,7 +305,7 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
 	ctx.prevsize = 0;
 	ctx.start_time = 0;
 
-	if (parse_url(uri, server_name, &port, &path, &is_https))
+	if (parse_url(uri, ctx.server_name, &ctx.port, &path, &is_https))
 		return CMD_RET_USAGE;
 
 	netif = net_lwip_new_netif(udev);
@@ -319,7 +317,7 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
 	if (is_https) {
 		tls_allocator.alloc = &altcp_tls_alloc;
 		tls_allocator.arg =
-			altcp_tls_create_config_client(NULL, 0, server_name);
+			altcp_tls_create_config_client(NULL, 0, ctx.server_name);
 
 		if (!tls_allocator.arg) {
 			log_err("error: Cannot create a TLS connection\n");