]> granicus.if.org Git - esp-idf/commit
HTTP Server : Close new session immediately if open_fn fails
authorAnurag Kar <anurag.kar@espressif.com>
Fri, 17 May 2019 11:31:29 +0000 (17:01 +0530)
committerbot <bot@espressif.com>
Tue, 28 May 2019 08:49:02 +0000 (08:49 +0000)
commit9c6bec203de071f3b87bf57a4afb5cfd2a55c09a
tree658bae8a3d74e6fb807c3f27232edeecafded1c2
parent550b1897c80e5a0936b1ff1e3a3923b7030fe19c
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
components/esp_http_server/include/esp_http_server.h
components/esp_http_server/src/httpd_sess.c