[PATCH 0/7] wget: Expose wget to applications

Adriano Cordova adrianox at gmail.com
Wed Nov 6 13:47:31 CET 2024


Currently the wget command is focused on downloading the next boot stage.
This series proposes to set wget as a general purpose HTTP request interface.
This series splits the wget code from the wget command and exposes wget HTTP
requests for applications to use. This comes in preparation for an efi HTTP 
driver.

This series proposes to expose wget via the following struct:

/*
*method:		Filled by client. Desired HTTP Method
*status_code:		Filled by wget. HTTP status code
*file_size:		Filled by wget. Download size
*buffer_size:		Filled by client. Size of client-provided buffer
*set_bootdev:		Filled by client. Set boot device with the next download
*check_buffer_size:	Filled by client. Check download does not exceed buffer size
*hdr_cont_len:		Filled by wget. Content length according to the HTTP headers
*headers:		Filled by wget. Client-provided buffer for headers
*/
struct wget_http_info {
	enum wget_http_method method;
	ulong status_code;
	ulong file_size;
	ulong buffer_size;
	bool set_bootdev; 
	bool check_buffer_size;
	u32 hdr_cont_len;
	char* headers;
};

extern struct wget_http_info wget_info;

The client can then set wget_info and call wget with wget_with_dns in a network stack 
agnostic way, providing the buffer and the uri as arguments.


Adriano Cordova (7):
  net: Kconfig: add CONFIG_WGET symbol
  net: wget: add definition of struct wget_http_info
  net: wget: Add a global struct wget_http_info
  net: wget: integrate struct wget_info into legacy wget code
  net: wget: make wget_with_dns return value compatible with its lwip
    version
  net/lwip: wget: put server_name and port into wget_ctx
  net/lwip: wget: integrate struct wget_info into wget code

 cmd/Kconfig          |  5 +--
 include/net-common.h | 29 ++++++++++++++
 net/Kconfig          |  8 ++++
 net/Makefile         |  2 +-
 net/lwip/Makefile    |  2 +-
 net/lwip/wget.c      | 47 ++++++++++++++++++++---
 net/net-common.c     | 10 +++++
 net/wget.c           | 91 +++++++++++++++++++++++++++++++++-----------
 8 files changed, 160 insertions(+), 34 deletions(-)

-- 
2.43.0



More information about the U-Boot mailing list