docs:add cn trans for esp-https-server.rst

This commit is contained in:
mofeifei
2022-05-17 17:36:10 +08:00
parent bf4afcbe57
commit 0cce36f0ec
2 changed files with 61 additions and 10 deletions

View File

@@ -1,23 +1,25 @@
HTTPS server
HTTPS Server
============
:link_to_translation:`zh_CN:[中文]`
Overview
--------
This component is built on top of `esp_http_server`. The HTTPS server takes advantage of hooks and function overrides in the regular HTTP server to provide encryption using OpenSSL.
This component is built on top of :doc:`esp_http_server`. The HTTPS server takes advantage of hook registration functions in the regular HTTP server to provide callback function for SSL session.
All documentation for `esp_http_server` applies also to a server you create this way.
All documentation for :doc:`esp_http_server` applies also to a server you create this way.
Used APIs
---------
The following API of `esp_http_server` should not be used with `esp_https_server`, as they are used internally to handle secure sessions and to maintain internal state:
The following APIs of :doc:`esp_http_server` should not be used with :doc:`esp_https_server`, as they are used internally to handle secure sessions and to maintain internal state:
* "send", "receive" and "pending" function overrides - secure socket handling
* "send", "receive" and "pending" callback registration functions - secure socket handling
* :cpp:func:`httpd_sess_set_send_override`
* :cpp:func:`httpd_sess_set_recv_override`
* :cpp:func:`httpd_sess_set_pending_override`
* "transport context" - both global and session
* :cpp:func:`httpd_sess_get_transport_ctx` - returns SSL used for the session
@@ -34,15 +36,14 @@ Usage
Please see the example :example:`protocols/https_server` to learn how to set up a secure server.
Basically all you need is to generate a certificate, embed it in the firmware, and provide its pointers and lengths to the start function via the init struct.
Basically, all you need is to generate a certificate, embed it into the firmware, and pass the init struct into the start function after the certificate address and lengths are correctly configured in the init struct.
The server can be started with or without SSL by changing a flag in the init struct - :cpp:member:`httpd_ssl_config::transport_mode`. This could be used e.g. for testing or in trusted environments where you prefer speed over security.
The server can be started with or without SSL by changing a flag in the init struct - :cpp:member:`httpd_ssl_config::transport_mode`. This could be used, e.g., for testing or in trusted environments where you prefer speed over security.
Performance
-----------
The initial session setup can take about two seconds, or more with slower clock speeds or more verbose logging. Subsequent requests through the open secure socket are much faster (down to under
100 ms).
The initial session setup can take about two seconds, or more with slower clock speed or more verbose logging. Subsequent requests through the open secure socket are much faster (down to under 100 ms).
API Reference
-------------