Skip to contentSkip to conversation

net: wget: add definition of struct wget_http_info

PATCH Superseded Adriano Cordova 3 participants 3 messages Nov 6, 2024 – Nov 8, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/7 net: wget: add definition of struct wget_http_info

The struct wget_http_info exposes the HTTP information of the last HTTP request issued by wget, and it controls whether the efi bootdevice is set, and whether the buffer size needs to be checked (lwip stack only). This information is otherwise discarded. The wget_http_info struct can be used by HTTP drivers to have more control over HTTP requests.

---
 include/net-common.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
include/net-common.h +27 -0
index fd7c5e7b48..38ba95cf60 100644
@@ -8,6 +8,7 @@
 #include <env.h>
 #include <hexdump.h>
 #include <linux/if_ether.h>
+#include <linux/sizes.h>
 #include <linux/types.h>
 #include <rand.h>
 #include <time.h>
@@ -506,4 +507,30 @@ int wget_with_dns(ulong dst_addr, char *uri);
 bool wget_validate_uri(char *uri);
 //int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
 
+enum wget_http_method {
+	WGET_HTTP_METHOD_GET,
+	WGET_HTTP_METHOD_POST,
+	WGET_HTTP_METHOD_PATCH,
+	WGET_HTTP_METHOD_OPTIONS,
+	WGET_HTTP_METHOD_CONNECT,
+	WGET_HTTP_METHOD_HEAD,
+	WGET_HTTP_METHOD_PUT,
+	WGET_HTTP_METHOD_DELETE,
+	WGET_HTTP_METHOD_TRACE,
+	WGET_HTTP_METHOD_MAX
+};
+
+#define MAX_HTTP_HEADERS_SIZE SZ_64K
+
+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;
+};
+
 #endif /* __NET_COMMON_H__ */
Signature · 1 line
2.43.0
Reviewed-by on v1 2/7
#1 lore raw
Quoted 44 lines · Adriano Cordova

The struct wget_http_info exposes the HTTP information of the last HTTP request issued by wget, and it controls whether the efi bootdevice is set, and whether the buffer size needs to be checked (lwip stack only). This information is otherwise discarded. The wget_http_info struct can be used by HTTP drivers to have more control over HTTP requests.

---
 include/net-common.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
include/net-common.h +18 -0
index fd7c5e7b48..38ba95cf60 100644
@@ -8,6 +8,7 @@
 #include <env.h>
 #include <hexdump.h>
 #include <linux/if_ether.h>
+#include <linux/sizes.h>
 #include <linux/types.h>
 #include <rand.h>
 #include <time.h>
@@ -506,4 +507,30 @@ int wget_with_dns(ulong dst_addr, char *uri);
 bool wget_validate_uri(char *uri);
 //int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
 
+enum wget_http_method {
+	WGET_HTTP_METHOD_GET,
+	WGET_HTTP_METHOD_POST,
+	WGET_HTTP_METHOD_PATCH,
+	WGET_HTTP_METHOD_OPTIONS,
+	WGET_HTTP_METHOD_CONNECT,
+	WGET_HTTP_METHOD_HEAD,
+	WGET_HTTP_METHOD_PUT,
+	WGET_HTTP_METHOD_DELETE,
+	WGET_HTTP_METHOD_TRACE,
+	WGET_HTTP_METHOD_MAX
+};
+
+#define MAX_HTTP_HEADERS_SIZE SZ_64K
+
+struct wget_http_info {
+	enum wget_http_method method;

include/net-common.h int wget_with_dns(ulong dst_addr, char *uri); · line 536

Quoted 10 lines
include/net-common.h +9 -0
+	ulong status_code;
+	ulong file_size;
+	ulong buffer_size;
+	bool set_bootdev;
+	bool check_buffer_size;
+	u32 hdr_cont_len;
+	char *headers;
+};
+
 #endif /* __NET_COMMON_H__ */

Thanks,

Signature · 1 line
Jerome
#2 lore raw
Quoted 12 lines · Jerome Forissier
Quoted 11 lines · Adriano Cordova

The struct wget_http_info exposes the HTTP information of the last HTTP request issued by wget, and it controls whether the efi bootdevice is set, and whether the buffer size needs to be checked (lwip stack only). This information is otherwise discarded. The wget_http_info struct can be used by HTTP drivers to have more control over HTTP requests.

---
  include/net-common.h | 27 +++++++++++++++++++++++++++
  1 file changed, 27 insertions(+)
Quoted 15 lines
Quoted 13 lines
include/net-common.h +1 -0
index fd7c5e7b48..38ba95cf60 100644
@@ -8,6 +8,7 @@
  #include <env.h>
  #include <hexdump.h>
  #include <linux/if_ether.h>
+#include <linux/sizes.h>
  #include <linux/types.h>
  #include <rand.h>
  #include <time.h>

include/net-common.h int wget_with_dns(ulong dst_addr, char *uri); · line 508

Quoted 2 lines
include/net-common.h +0 -0
@@ -506,4 +507,30 @@ int wget_with_dns(ulong dst_addr, char *uri);
  bool wget_validate_uri(char *uri);
  //int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);

Please, add documentation for the enum, MAX_HTTP_HEADERS_SIZE, and the struct.

The U-Boot project follows
https://docs.kernel.org/doc-guide/kernel-doc.html#.

Otherwise looks good to me.

Please, CC Ilias as this series is the prerequisite for your EFI_HTTP_PROTOCOL series.

Best regards

Heinrich

Quoted 32 lines
Quoted 18 lines
include/net-common.h +17 -0
+enum wget_http_method {
+	WGET_HTTP_METHOD_GET,
+	WGET_HTTP_METHOD_POST,
+	WGET_HTTP_METHOD_PATCH,
+	WGET_HTTP_METHOD_OPTIONS,
+	WGET_HTTP_METHOD_CONNECT,
+	WGET_HTTP_METHOD_HEAD,
+	WGET_HTTP_METHOD_PUT,
+	WGET_HTTP_METHOD_DELETE,
+	WGET_HTTP_METHOD_TRACE,
+	WGET_HTTP_METHOD_MAX
+};
+
+#define MAX_HTTP_HEADERS_SIZE SZ_64K
+
+struct wget_http_info {
+	enum wget_http_method method;

include/net-common.h int wget_with_dns(ulong dst_addr, char *uri); · line 536

Quoted 10 lines
include/net-common.h +9 -0
+	ulong status_code;
+	ulong file_size;
+	ulong buffer_size;
+	bool set_bootdev;
+	bool check_buffer_size;
+	u32 hdr_cont_len;
+	char *headers;
+};
+
  #endif /* __NET_COMMON_H__ */

Thanks,