Wykres commitów

63 Commity (7d5ae1ee263d654512af2886366cd3a2922a5843)

Autor SHA1 Wiadomość Data
Siarhei Volkau ba15970abb esp_http_server, protocomm: Consider a connection as closed if recv() returns 0
This check prevents infinite loop on closed sockets

Closes https://github.com/espressif/esp-idf/pull/6541

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2021-06-08 05:48:30 +00:00
Jan Brudny 967e057906 esp-tls, esp_http_client and esp_http_server: update copyright notice 2021-05-31 20:06:09 +08:00
Aditya Patwardhan 3e82fcd566 esp_http_server: Fix transport_ctx not getting freed
Closes https://github.com/espressif/esp-idf/issues/6813
2021-04-07 05:25:39 +00:00
yuanjm 382fe8807d httpd: Support user_ctx in websocket handler callback request
Closes https://github.com/espressif/esp-idf/issues/6538
2021-03-10 12:31:38 +00:00
Mahavir Jain 907ea44ee9 Merge branch 'feature/http_server_optimizations' into 'master'
esp_http_server optimisations

Closes IDFGH-4484 and IDFGH-4741

See merge request espressif/esp-idf!12240
2021-03-08 09:01:20 +00:00
Shubham Kulkarni 6a7587d35f esp_http_server: Run format.sh script to fix code style issues 2021-03-04 04:08:47 +00:00
Jermolinski 282726b619 The httpd_sess_* functions have been re-designed to speed up the httpd server
Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>

Merges: https://github.com/espressif/esp-idf/pull/6313
2021-03-04 04:08:47 +00: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
yuanjm da58235a0e components: Use CONFIG_LWIP_IPV6 to strip IPv6 function in components 2021-02-23 18:26:03 +08:00
David Cermak c415c6f9a6 httpd: Fixed wrong header in ws_send_async() for lengthy packets
Closes https://github.com/espressif/esp-idf/issues/6196
2021-01-18 12:13:58 +00:00
Shubham Kulkarni 00876a8946 esp_http_server: Add lru_socket flag in sock_db to indicate httpd_sess_close is called from httpd_sess_close_lru 2021-01-15 05:53:41 +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
Angus Gratton 66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Ivan Grokhotkov b6467257b9 Merge branch 'feature/cmock_component' into 'master'
cmock as component replacing unity

See merge request espressif/esp-idf!9859
2020-09-10 16:06:20 +08: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
Jakob Hasse 20c068ef3b cmock: added cmock as component
* changing dependencies from unity->cmock
* added component.mk and Makefile.projbuild
* ignore test dir in gen_esp_err_to_name.py
* added some brief introduction of CMock in IDF
2020-09-02 16:38:37 +08: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
Shubham Kulkarni 0ec5096742 esp_http_server: Update LRU counter on accepting a new connection
Closes https://github.com/espressif/esp-idf/issues/3851
2020-06-26 05:29:00 +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
Piyush Shah c2ab112590 esp_http_server: Fixed a bug which could cause issues with LRU purge
LRU counter should be started from 1, and not 0, so that all checks
work fine.

Closes https://github.com/espressif/esp-idf/issues/4753
2020-05-19 22:11:02 +05:30
Renz Bagaporo 3d0967a58a test: declare requirements and include dirs private 2020-03-23 10:58:50 +08: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
Konstantin Kondrashov 739eb05bb9 esp32: add implementation of esp_timer based on TG0 LAC timer
Closes: IDF-979
2020-02-06 14:00:18 +08:00
Chinmay Chhajed a6cc964a26 esp_http_server : Bugfix in parsing of empty header values
This MR is intended to fix incorrect parsing of HTTP requests when empty header values are present.

The issue is was due to asymmetric behavior of `http_parser` library, which in case of:

    non-empty header values : invokes callbacks with the pointer to the start of a value
    empty header values : invokes callbacks with pointer to the start of next header or section

Since HTTP server relies on this pointer (along with length of the value) to locate the end of a value, and replace the line terminators (CRLFs) with null characters, the second case needed to be handled correctly.

Closes IDFGH-1539

Closes https://github.com/espressif/esp-idf/issues/3803
2019-09-06 11:02:36 +08:00
Roland Dobai 612db28b6f Fix error code collision and CI check 2019-08-29 08:14:08 +00:00
Piyush Shah c93cab858e httpd_sess_close: Check for session validity before closing
If httpd_sess_trigger_close() gets called twice for the same socket,
the first httpd_sess_close() cb closes the correct socket, but the second
invocation closes the wrong socket which was just accepted and added to
the socket db. Checking for the lru counter will help identify this as the
counter is set only for requests actually served.
2019-08-06 19:31:57 +05:30
Anton Maklakov afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
xueyunfei fa02598b5c lwip_2.1.2 for idf_4.0 2019-07-07 01:51:45 +00:00
Renz Christian Bagaporo 9b350f9ecc cmake: some formatting fixes
Do not include bootloader in flash target when secure boot is enabled.
Emit signing warning on all cases where signed apps are enabled (secure
boot and signed images)
Follow convention of capital letters for SECURE_BOOT_SIGNING_KEY
variable, since it is
relevant to other components, not just bootloader.
Pass signing key and verification key via config, not requiring
bootloader to know parent app dir.
Misc. variables name corrections
2019-06-21 19:53:29 +08:00
Renz Christian Bagaporo 9eccd7c082 components: use new component registration api 2019-06-21 19:53:29 +08:00
Anurag Kar 9c6bec203d HTTP Server : Close new session immediately if open_fn fails
open_fn() was introduced in the context of HTTPS server, as a configurable callback function that is called by the HTTP server, on every newly created socket. It is responsible of allocating resources for per session transport security.

Earlier, if open_fn were to fail, the newly created socket would be closed by the server but the corresponding entry, for the now invalid socket, will remain in the internal socket database until that invalid socket is detected due to error when calling select(). Because of this delayed closing of sockets, the HTTPS server would quickly face shortage of available sessions when a lot of SSL handshake errors are happening (this typically occurs when a browser finds that the server certificate is self signed). This changes in this MR fix this issue by clearing up the socket from internal database, right after open_fn fails.

Closes https://github.com/espressif/esp-idf/issues/3479
2019-05-28 08:49:02 +00:00
Angus Gratton 0458bacc4e Merge branch 'bugfix/httpd_log_purge' into 'master'
esp_http_server : Logging of purged data to monitor made configurable

Closes IDFGH-1034

See merge request idf/esp-idf!4941
2019-05-14 18:07:51 +08:00
Anurag Kar 6bf423d1e1 esp_http_server : Logging of purged data to monitor made configurable
List of changes:
* Kconfig option HTTPD_LOG_PURGE_DATA enables logging of purged data
* Kconfig option HTTPD_PURGE_BUF_LEN sets purge buffer length
* Purged data is logged in hex

Closes https://github.com/espressif/esp-idf/issues/3359
2019-05-10 14:25:39 +05:30
Anurag Kar 5e1c19d73d esp_http_server : Minor clarification in httpd_req_get_url_query_str() API documentation
Closes https://github.com/espressif/esp-idf/issues/3374
2019-05-06 14:32:24 +05:30
Anurag Kar ffad8b27a3 esp_http_server : Allow binding to same address and port upon restarting server without delay
Issue : Restarting the server without 30sec delay between httpd_stop() and httpd_start() causes EADDRINUSE error
Resolution : Use setsockopt() to enable SO_REUSEADDR on listener socket

Closes https://github.com/espressif/esp-idf/issues/3381
2019-05-02 05:29:38 +00:00
Anurag Kar 9542063236 esp_http_server : Test added to check limit on max_open_sockets config option 2019-04-03 13:34:12 +00:00
Anurag Kar 7e676c1055 esp_http_server : Only accept new connections if server has capacity to handle more
This fix prevents HTTP server from accepting new connections when the total count of connected
sockets has reached the max_open_sockets limit set during configuration. The pending connections
are kept in backlog until atleast one of the connected sockets is closed. The maximum number of
connection requests that can kept in backlog is specified as backlog_conn configuration option.
Note that this modification has no effect when LRU purge is enabled.

Also added sanity check on setting for max_open_sockets during configuration.

Solution suggested by jimparis https://github.com/espressif/esp-idf/issues/3183#issue-421234265

Closes https://github.com/espressif/esp-idf/issues/3183
2019-04-03 13:34:12 +00:00
Anurag Kar 990af312d1 HTTP Server : Fix for tolerating LF terminated headers
List of changes:
* When parsing requests, count termination from LF characters only
* Correct memcpy() length parameter in httpd_unrecv() (pointed out by jimparis in GitHub issue thread)
* Use ssize_t to store results of length subtractions during parsing
* Modify some comments to reduce ambiguity

Closes https://github.com/espressif/esp-idf/issues/3182
2019-03-26 14:21:40 +05:30
Gregory Eslinger 7f1047847a HTTP Server: Added ability to select core
The task that runs the HTTP server can now be pinned to a particular core by setting `core_id`
in the HTTP server configuration.  By default, the core is set to `tskNO_AFFINITY`, meaning
it can run on any core.

Merges https://github.com/espressif/esp-idf/pull/3190
2019-03-21 11:22:58 +08:00
Piyush Shah f28f4016cb esp_http_server: Provide apps an option to let http_server ignore sess_ctx changes
By default, if a URI handler changes the http session context,
the webserver internally clears the older context after the handler
returns. However, if applications want to change this behavior and
manage the allocation/de-allocation/freeing themselves and let the
server handle only the "socket close" case, this commit provides such
an option.
2019-03-05 00:21:03 +05:30
Angus Gratton 19fd436e88 Merge branch 'esp_http_server/lru_counter_for_timestamp' into 'master'
esp_http_server/lru_counter_for_timestamp:Added LRU counter for timer

See merge request idf/esp-idf!4205
2019-02-28 07:04:21 +08:00
Supreet Deshpande 4c8e997289 esp_http_server/lru_counter_for_timestamp:Added LRU counter for timer
Replaced the os timer in http server by LRU counter. The timestamp is
unnecessary for LRU.
2019-02-25 10:08:15 +00:00