mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-21 12:25:27 +00:00
net: wget: Add interface to issue wget_requests using wget_http_info
Declare and define a global default struct wget_http_info and an interface to issue wget requests providing a custom struct wget_http_info. This code is common to legacy wget and lwip wget. The idea is that the command wget should use the default wget_http_info and other internal u-boot code can call wget_request with their own wget_http_info struct. Signed-off-by: Adriano Cordova <adrianox@gmail.com>
This commit is contained in:
parent
408af97674
commit
1de93fda99
2 changed files with 18 additions and 0 deletions
|
@ -554,4 +554,8 @@ struct wget_http_info {
|
||||||
char *headers;
|
char *headers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern struct wget_http_info default_wget_info;
|
||||||
|
extern struct wget_http_info *wget_info;
|
||||||
|
int wget_request(ulong dst_addr, char *uri, struct wget_http_info *info);
|
||||||
|
|
||||||
#endif /* __NET_COMMON_H__ */
|
#endif /* __NET_COMMON_H__ */
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include <net-common.h>
|
||||||
|
|
||||||
void copy_filename(char *dst, const char *src, int size)
|
void copy_filename(char *dst, const char *src, int size)
|
||||||
{
|
{
|
||||||
|
@ -11,3 +12,16 @@ void copy_filename(char *dst, const char *src, int size)
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wget_http_info default_wget_info = {
|
||||||
|
.method = WGET_HTTP_METHOD_GET,
|
||||||
|
.set_bootdev = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wget_http_info *wget_info;
|
||||||
|
|
||||||
|
int wget_request(ulong dst_addr, char *uri, struct wget_http_info *info)
|
||||||
|
{
|
||||||
|
wget_info = info ? info : &default_wget_info;
|
||||||
|
return wget_with_dns(dst_addr, uri);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue