feat(http): Modify for esp8266

This commit is contained in:
yuanjm
2020-08-07 11:47:43 +08:00
parent 9ea5d2abe7
commit 08a4fe0d61
7 changed files with 19 additions and 6 deletions

View File

@ -4,5 +4,5 @@ idf_component_register(SRCS "esp_http_client.c"
"lib/http_utils.c"
INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS "lib/include"
REQUIRES nghttp
PRIV_REQUIRES mbedtls lwip esp-tls tcp_transport)
REQUIRES http_parser
PRIV_REQUIRES mbedtls lwip esp-tls tcp_transport tcpip_adapter)

View File

@ -14,4 +14,10 @@ menu "ESP HTTP client"
This option will enable HTTP Basic Authentication. It is disabled by default as Basic
auth uses unencrypted encoding, so it introduces a vulnerability when not using TLS
config HTTP_BUF_SIZE
int "Default HTTP Buffer Size (both send and receive)"
default 512
range 512 1460
help
Set HTTP Buffer Size. The larger buffer size will make send and receive more size packet once.
endmenu

View File

@ -24,7 +24,7 @@
extern "C" {
#endif
#define DEFAULT_HTTP_BUF_SIZE (512)
#define DEFAULT_HTTP_BUF_SIZE CONFIG_HTTP_BUF_SIZE
typedef struct esp_http_client *esp_http_client_handle_t;
typedef struct esp_http_client_event *esp_http_client_event_handle_t;

View File

@ -19,7 +19,7 @@
#include "esp_netif.h"
#include "lwip/sockets.h"
#include "esp32/rom/md5_hash.h"
#include "rom/md5_hash.h"
#include "mbedtls/base64.h"
#include "esp_system.h"
@ -81,6 +81,10 @@ char *http_auth_digest(const char *username, const char *password, esp_http_auth
return NULL;
}
if (auth_data->algorithm == NULL) {
auth_data->algorithm = "md5";
}
ha1 = calloc(1, MD5_MAX_LEN);
HTTP_MEM_CHECK(TAG, ha1, goto _digest_exit);

View File

@ -15,7 +15,7 @@
#ifndef _HTTP_HEADER_H_
#define _HTTP_HEADER_H_
#include "sys/queue.h"
#include "rom/queue.h"
#include "esp_err.h"
#ifdef __cplusplus