feature/esp_http_server_idf_v3.2:Changes to make esp_http_server compatible with ESP8266.

Changes:
Lru counter in place of timestamp added.
syslimits.h definition guards for ARG_MAX, PATH_LEN.
Renamed src/port/esp32 to src/port/esp8266.
Enabled working without IPv6. Test Scripts requiring TinyFW removed
Utility.console_log replaced by print.
This commit is contained in:
Supreet Deshpande
2019-02-18 15:07:09 +05:30
parent 825a53199d
commit efc81a6649
12 changed files with 136 additions and 426 deletions

View File

@@ -236,19 +236,32 @@ static void httpd_thread(void *arg)
static esp_err_t httpd_server_init(struct httpd_data *hd)
{
#ifdef CONFIG_LWIP_IPV6
int fd = socket(PF_INET6, SOCK_STREAM, 0);
#else
int fd = socket(PF_INET, SOCK_STREAM, 0);
#endif /* CONFIG_LWIP_IPV6 */
if (fd < 0) {
ESP_LOGE(TAG, LOG_FMT("error in socket (%d)"), errno);
return ESP_FAIL;
}
#ifdef CONFIG_LWIP_IPV6
struct in6_addr inaddr_any = IN6ADDR_ANY_INIT;
struct sockaddr_in6 serv_addr = {
.sin6_family = PF_INET6,
.sin6_addr = inaddr_any,
.sin6_port = htons(hd->config.server_port)
};
#else
struct sockaddr_in serv_addr = {
.sin_family = PF_INET,
.sin_addr = {
.s_addr = htonl(INADDR_ANY)
},
.sin_port = htons(hd->config.server_port)
};
#endif /* CONFIG_LWIP_IPV6 */
int ret = bind(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
if (ret < 0) {
ESP_LOGE(TAG, LOG_FMT("error in bind (%d)"), errno);