65 Commits

Author SHA1 Message Date
Ashish Sharma 7e2e09c15c feat(esp_http_server): Adds support to bind an interface to server
Closes https://github.com/espressif/esp-idf/issues/17859
2026-03-24 17:38:01 +08:00
Ashish Sharma b64c70acda fix: fixes memory leak with subprotocols 2026-03-23 18:37:21 +08:00
Ashish Sharma 5028b6230f feat(http_server): improve websocket server handling
1. Adds post handshake callback
2. Removes requirement to handle HTTP_GET message in websocket handler

Closes https://github.com/espressif/esp-idf/issues/18215
2026-02-27 09:59:05 +08:00
nilesh.kale 93fcdda9f4 feat: add demo to receive websocket frame in chunks
This commit added demo to receive websocket single frame in chunks
using newly added API httpd_ws_recv_frame_part() with optimized memory.

closes https://github.com/espressif/esp-idf/pull/15622
2026-01-07 15:25:19 +05:30
mrsobakin 67339c5f4a feat(websocket): Support partial frame payload reads 2026-01-07 15:12:41 +05:30
Mahavir Jain 354e9ed64a feat(esp_http_server): Make httpd_handle_err API as public
This makes sense because httpd_register_err_handler API is
already public. So the above API complements this API.

Closes https://github.com/espressif/esp-idf/issues/17755
2025-12-31 10:23:07 +05:30
hrushikesh.bhosale bdf438f0aa fix(http_server): Removed the build failure due to unused variables
There were build failure due the unused variable last_error when
ESP_HTTPS_SERVER_EVENTS and HTTPD_ENABLE_EVENTS are disabled
2025-12-11 12:33:03 +05:30
Jimmy Wennlund bd85dad2cf feat(esp_http_server): Make HTTP(S)_SERVER_EVENT events optional
Make it possible to disable http(s) server events. This improves
performance of the server, as http server creates events on every signle
read or write to the socket.
2025-11-22 21:30:58 +01:00
hrushikesh.bhosale a40ceffb19 feat(esp_http_server): Added pre handshake callback for websocket
1. If the user wants authenticate the request, then user needs to do
this before upgrading the protocol to websocket.
2. To achieve this, added pre_handshake_callack, which will execute
before handshake, i.e. before switching protocol.
2025-07-31 11:06:18 +05:30
hrushikesh.bhosale 9f6ab55a5b feat(http_server): Added API to get scratch buffer data
1. Added the API in esp_http_server to get the raw headers data
from the scratch buffer.
2. This data will be unparsed.

Closes https://github.com/espressif/esp-idf/issues/15857
2025-07-09 18:36:52 +05:30
WangLei1993 a2ce331ef9 fix(esp_http_server): Fix incorrect spelling in the comments 2025-04-20 15:57:03 +08:00
Mahavir Jain 4b6c5f34cd fix(esp_http_server): enable doxygen build for websocket API reference
Closes https://github.com/espressif/esp-idf/issues/15523
2025-03-05 20:06:16 +05:30
hrushikesh.bhosale 9846584def feat(esp_http_server): Modified the calculation of buf_len
Modified the calculation of buf_len, so that scratch buffer allocates
the memory according to requirement and not extra (except the last read chunk)
2025-02-13 17:15:07 +05:30
hrushikesh.bhosale 97b6043435 feat(esp_http_server): Dynamically allocate http server's scratch buffer
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
2025-02-11 09:41:26 +05:30
hrushikesh.bhosale 84b8df8f3f feat(https_server): Added checks to verify if uri is empty
Added the checks if the URI is empty for the funtions httpd_req_get_url_query_len
and httpd_req_get_url_query_str in httpd_parser.c
2025-01-07 16:58:54 +08:00
nilesh.kale d5ccc60eb0 feat(esp_http_server): add support to handle HTTP 1.0 requests
This commit adds support to handle HTTP/1.0 requests alongside HTTP/1.1 for
legacy compliance purposes.
2024-12-11 15:32:32 +05:30
nick black 6b3ae2822d docs: fix all references to HTTPD_{GET,POST,PUT} 2024-11-04 16:13:07 +08:00
Yogesh Mantri 586207207f change(esp_netif): Add Non-Fatal errtype to indicate lower layer medium failure
UDP application sends packet using esp_netif, underlying transport such
as Wi-Fi may drop the packet due to higher load. New error code
represent transient, non-fatal packet drop error. udp application may
use such errtype, for example to rate limit.
2024-06-11 09:20:49 +02:00
Harshit Malpani 61a3466941 fix: Fix spelling mistakes in esp_http_server.h 2024-05-29 18:30:00 +05:30
Maciej Małecki e40b1402e4 feat(http_server): add 413 Payload Too Large response
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>
2024-05-29 18:30:00 +05:30
Harshit Malpani 1d81af367d feat: support HTTP_ANY method in esp_http_server
Closes https://github.com/espressif/esp-idf/issues/12794
2024-01-15 14:32:06 +05:30
Harshit Malpani ae71e1ddb9 fix(esp_http_server): Add support for custom HTTP status codes
Closes https://github.com/espressif/esp-idf/issues/12399
2023-12-20 16:59:38 +05:30
Alon Bar-Lev af79fe0495 change(components/esp_http_server): add task_caps configuration
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>
2023-12-13 12:26:59 +05:30
Harshit Malpani 692e1a9e61 feat: ECDSA peripheral while performing http connection with mutual auth 2023-09-08 12:22:41 +05:30
Chip Weinberger 3824eba04d feat(httpd): add support for asynchronous request handling
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>
2023-05-19 10:05:42 +05:30
Harshit Malpani 7c68b67295 esp_http_server: Update to support build for Linux 2023-03-31 16:42:05 +05:30
Harshit Malpani 0885d8542d esp_http_server: Added support for esp_events 2022-12-19 17:33:37 +05:30
Mahavir Jain 79216c657e esp_http_server: modify error print for clarifying internal socket usage
Closes https://github.com/espressif/esp-idf/issues/10108
Closes IDFGH-8663
2022-11-15 20:46:35 +05:30
Mahavir Jain 34f3287323 esp_http_server: fix default control port for HTTPS configuration
For simultaneous HTTP and HTTPS server use-case, default configurations
set same control socket port and hence one of the server initialization
fails with an error "error in creating control socket".

This commit modifies default initializers to use different control
socket port in HTTP vs HTTPS server case.

Closes https://github.com/espressif/esp-idf/issues/10160
Closes IDFGH-8719
2022-11-15 20:46:35 +05:30
yuanjianmin e05d61d075 esp_http_server: Add support to enable TCP keepalive config
Closes https://github.com/espressif/esp-idf/issues/9848
2022-10-31 14:37:05 +08:00
Harshit Malpani a3fd6d1070 esp_http_server: Add linger in httpd_config_t
Closes: https://github.com/espressif/esp-idf/issues/9514
2022-09-22 10:11:50 +05:30
Harshit Malpani 73fc12cdcd esp_http_server: Remove http_server.h Header file 2022-05-13 16:00:17 +05:30
FlorianR 4db3fd17d9 Clarify when the socket is closed if a custom session closing callback is used
When using a custom session closing callback, the IDF will not close the socket for the user. This might result in the system running out of fds. Without any note on that in the documentation, this is easy to miss.
2021-11-25 17:19:11 +08:00
Martin Valik 1f451a4a77 Added more convenient functions for sending data to websocket 2021-09-16 10:53:29 +02:00
Patryk Krzywdziński f43e9cdaa7 http: Function to get Cookie value from request.
Closes https://github.com/espressif/esp-idf/pull/7273

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2021-07-30 13:23:25 +08:00
Jan Brudny 967e057906 esp-tls, esp_http_client and esp_http_server: update copyright notice 2021-05-31 20:06:09 +08:00
Martin Valik f221b1655d httpd: remove redundant condition from get_client_list()
Premature return from httpd_uri() was also removed to call uri handler after establishing websocket.
2021-03-04 03:23:57 +00:00
yuanjm cd521d4ae3 esp_http_server: support dynamic payload len for ws server
Closes https://github.com/espressif/esp-idf/issues/6433
2021-02-24 11:40:34 +00:00
Liu Han 669d9820fc esp_http_server: Add some response error code, such as 401, 403 etc.
Closes https://github.com/espressif/esp-idf/issues/5466
2020-12-09 06:22:01 +00:00
Marius Vikhammer dcb09bac6a http_server: adds support for setting websocket subprotocol
Adds support for setting support subprotocol per websocket URI
2020-11-13 06:40:51 +00:00
David Cermak 6f3fa81863 http_server: Simplified httpd_get_client_list() to return clients in int array 2020-09-09 08:00:20 +02:00
David Cermak 5e1e5f8be9 http_server: Add a flag to enable using control frames in user handlers 2020-09-09 08:00:20 +02:00
David Cermak fbf2680427 esp_http_server: Add Websocket API to return list of active clients
Closes https://github.com/espressif/esp-idf/issues/5406
2020-09-09 08:00:20 +02:00
David Cermak d3801be6d9 esp_http_server: Add httpd_ws_get_fd_info() API to check active WS clients
Added a new API to WebSocket server to test provided socket descriptor if it belongs to active clients for this server and if websocket handshake has been performed

Closes https://github.com/espressif/esp-idf/issues/5602
2020-09-03 20:40:11 +02:00
David Čermák f8b649baaf Merge branch 'bugfix/ws_server_async_send_fin' into 'master'
http_server example: WebSocket server to set final flag in async messages

Closes IDFGH-3443

See merge request espressif/esp-idf!9251
2020-07-15 05:31:02 +08:00
David Cermak 005f21accc http_server: WebSocket server to set flag in transmitted messages by default
Add logic to set `FIN` flag automatically for transmitted WS frames, but
if `fragmented` option set indicating an expert/manual mode, then the
`FIN` flag is set according to the `final` option.
2020-07-13 14:39:22 +00:00
sU8U7SfkcwTJVH7PjaVmej7D 6673407f98 httpd_resp_send: use HTTPD_RESP_USE_STRLEN when possible 2020-07-13 05:34:56 +00:00
Piyush Shah 24587ccbbf esp_http_server: Expose low level socket send/recv APIs
For some advanced use cases, the low level APIs may be useful.
2020-06-11 01:56:47 +00:00
David Cermak 1b842ce1a8 http_server: websocket server to support async send 2020-03-18 20:24:46 +00:00
Jackson Ming Hu e983042af2 http_server: adds WebSocket support
This commit adds the WebSocket support for esp_http_server
library. It mainly does:

- Handling WebSocket handshake
  - Parsing HTTP upgrade request
  - Reply the upgrade request
- Receive WebSocket packets
  - Parse header, decode to a struct
  - Unmask payload (if required)
- Send WebSocket frames
- Receive WebSocket frame
- Automatic control frame handling

Merges https://github.com/espressif/esp-idf/pull/4306
Closes https://github.com/espressif/esp-idf/issues/4819
2020-03-18 20:24:46 +00:00