res_buf was not freed for the chunk response type in case of
first_chunk_sent true condition.
This commit ensures that resp_buf is freed and few cosmetic
changes are made
In this commit, esp_http_server's http_parser scratch is made dynamic.
User is asked to give limit size for header and URI, according to which
scratch buufer allocates memory upto limits
The socket address length is not typecasted properly while
passing to bind and sendto functions. Due to this
http_server/simple was not running with target linux on MacOS
used to give error -
I (132253266) port: Starting scheduler.
I (132253269) esp_netif_loopback: loopback initialization
I (132253269) example: Starting server on port: '8001'
E (132253270) httpd: httpd_server_init: error in creating ctrl socket (22)
I (132253270) example: Error starting server!
With this commit, simple http server runs with target linux
on MacOS for IPV4 configurations
Static task creation on Linux target had issues with insufficient stack
memory allocation. Type of `StackType_t` is `unsigned long` and hence
it must be considered during stack memory allocation.
Fix ensures proper working of simple HTTP server example.
While not useful for the HTTP parser itself, this is very useful for
memory-limited consumers of the HTTP server API.
Signed-off-by: Harshit Malpani <harshit.malpani@espressif.com>
Event posting to the event loop should not hinder the working of
HTTP Client or HTTP Server. This commit add a config option to set
the timeout for posting the events to the loop.
Closes https://github.com/espressif/esp-idf/issues/13641
This resolves bug #13430 by allocating a new copy of resp_hdrs
when calling httpd_req_async_handler_begin(), thus preventing
invalid access to memory from async tasks.
* Users can now use libbsd string.h and sys/cdefs.h functionality
(e.g., strlcpy, containerof) on Linux by just including
string.h or sys/cdefs.h. In other words, the includes are the same
on the Linux target as well as on chips targets (ESP32, etc.).
* libbsd linking is done by the linux component (belongs to common
components) now instead of handling it separately in each component
The HTTP server is not a critical component, it would be nice if we can
control the task caps by using configuration.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Harshit Malpani <harshit.malpani@espressif.com>
This commit adds support for handling multiple requests simultaneously by introducing two new functions: `httpd_req_async_handler_begin()` and `httpd_req_async_handler_complete()`. These functions allow creating an asynchronous copy of a request that can be used on a separate thread and marking the asynchronous request as completed, respectively.
Additionally, a new flag `for_async_req` has been added to the `httpd_sess_t` struct to indicate if a socket is being used for an asynchronous request and should not be purged from the LRU cache.
An example have been added to demonstrate the usage of these new functions.
Closes https://github.com/espressif/esp-idf/issues/10594
Signed-off-by: Harshit Malpani <harshit.malpani@espressif.com>
- The callback `open_fn` is used for creating a new SSL session
with httpd_sess_new.
- If the call fails, the active socket count (httpd_data->hd_sd_active_count)
is not incremented. But, httpd_sess_delete is called, which decrements the
count, resulting in a negative value for several failed session creations
in a row.
Closes https://github.com/espressif/esp-idf/issues/9683
This commit removes the usage of all legacy FreeRTOS data types that
are exposed via configENABLE_BACKWARD_COMPATIBILITY. Legacy types can
still be used by enabling CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY.