From 2af9d7e0ed92d8c8aedd34d7e379cb579a4568a5 Mon Sep 17 00:00:00 2001 From: Anurag Kar Date: Wed, 24 Oct 2018 15:12:50 +0530 Subject: [PATCH 1/4] HTTP Server : Added esp_ prefix to http_server component files --- components/esp32/esp_err_to_name.c | 8 ++++---- .../{http_server => esp_http_server}/CMakeLists.txt | 0 components/{http_server => esp_http_server}/Kconfig | 0 components/{http_server => esp_http_server}/component.mk | 0 .../include/esp_http_server.h} | 6 +++--- components/esp_http_server/include/http_server.h | 2 ++ .../httpd_priv.h => esp_http_server/src/esp_httpd_priv.h} | 2 +- .../{http_server => esp_http_server}/src/httpd_main.c | 4 ++-- .../{http_server => esp_http_server}/src/httpd_parse.c | 4 ++-- .../{http_server => esp_http_server}/src/httpd_sess.c | 4 ++-- .../{http_server => esp_http_server}/src/httpd_txrx.c | 4 ++-- .../{http_server => esp_http_server}/src/httpd_uri.c | 4 ++-- .../src/port/esp32/osal.h | 0 .../{http_server => esp_http_server}/src/util/ctrl_sock.c | 0 .../{http_server => esp_http_server}/src/util/ctrl_sock.h | 0 components/esp_http_server/test/CMakeLists.txt | 6 ++++++ .../{http_server => esp_http_server}/test/component.mk | 0 .../test/test_http_server.c | 2 +- components/http_server/test/CMakeLists.txt | 6 ------ 19 files changed, 27 insertions(+), 25 deletions(-) rename components/{http_server => esp_http_server}/CMakeLists.txt (100%) rename components/{http_server => esp_http_server}/Kconfig (100%) rename components/{http_server => esp_http_server}/component.mk (100%) rename components/{http_server/include/http_server.h => esp_http_server/include/esp_http_server.h} (99%) create mode 100644 components/esp_http_server/include/http_server.h rename components/{http_server/src/httpd_priv.h => esp_http_server/src/esp_httpd_priv.h} (99%) rename components/{http_server => esp_http_server}/src/httpd_main.c (99%) rename components/{http_server => esp_http_server}/src/httpd_parse.c (99%) rename components/{http_server => esp_http_server}/src/httpd_sess.c (99%) rename components/{http_server => esp_http_server}/src/httpd_txrx.c (99%) rename components/{http_server => esp_http_server}/src/httpd_uri.c (99%) rename components/{http_server => esp_http_server}/src/port/esp32/osal.h (100%) rename components/{http_server => esp_http_server}/src/util/ctrl_sock.c (100%) rename components/{http_server => esp_http_server}/src/util/ctrl_sock.h (100%) create mode 100644 components/esp_http_server/test/CMakeLists.txt rename components/{http_server => esp_http_server}/test/component.mk (100%) rename components/{http_server => esp_http_server}/test/test_http_server.c (99%) delete mode 100644 components/http_server/test/CMakeLists.txt diff --git a/components/esp32/esp_err_to_name.c b/components/esp32/esp_err_to_name.c index 3882d4bf4f..dd1b81614c 100644 --- a/components/esp32/esp_err_to_name.c +++ b/components/esp32/esp_err_to_name.c @@ -13,6 +13,9 @@ #if __has_include("esp_http_client.h") #include "esp_http_client.h" #endif +#if __has_include("esp_http_server.h") +#include "esp_http_server.h" +#endif #if __has_include("esp_image_format.h") #include "esp_image_format.h" #endif @@ -37,9 +40,6 @@ #if __has_include("esp_wps.h") #include "esp_wps.h" #endif -#if __has_include("http_server.h") -#include "http_server.h" -#endif #if __has_include("nvs.h") #include "nvs.h" #endif @@ -456,7 +456,7 @@ static const esp_err_msg_t esp_err_msg_table[] = { # ifdef ESP_ERR_HTTP_EAGAIN ERR_TBL_IT(ESP_ERR_HTTP_EAGAIN), /* 28679 0x7007 Mapping of errno EAGAIN to esp_err_t */ # endif - // components/http_server/include/http_server.h + // components/esp_http_server/include/esp_http_server.h # ifdef ESP_ERR_HTTPD_BASE ERR_TBL_IT(ESP_ERR_HTTPD_BASE), /* 32768 0x8000 Starting number of HTTPD error codes */ # endif diff --git a/components/http_server/CMakeLists.txt b/components/esp_http_server/CMakeLists.txt similarity index 100% rename from components/http_server/CMakeLists.txt rename to components/esp_http_server/CMakeLists.txt diff --git a/components/http_server/Kconfig b/components/esp_http_server/Kconfig similarity index 100% rename from components/http_server/Kconfig rename to components/esp_http_server/Kconfig diff --git a/components/http_server/component.mk b/components/esp_http_server/component.mk similarity index 100% rename from components/http_server/component.mk rename to components/esp_http_server/component.mk diff --git a/components/http_server/include/http_server.h b/components/esp_http_server/include/esp_http_server.h similarity index 99% rename from components/http_server/include/http_server.h rename to components/esp_http_server/include/esp_http_server.h index 6a8e65c794..4880c66acd 100644 --- a/components/http_server/include/http_server.h +++ b/components/esp_http_server/include/esp_http_server.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _HTTP_SERVER_H_ -#define _HTTP_SERVER_H_ +#ifndef _ESP_HTTP_SERVER_H_ +#define _ESP_HTTP_SERVER_H_ #include #include @@ -993,4 +993,4 @@ esp_err_t httpd_queue_work(httpd_handle_t handle, httpd_work_fn_t work, void *ar } #endif -#endif /* ! _HTTP_SERVER_H_ */ +#endif /* ! _ESP_HTTP_SERVER_H_ */ diff --git a/components/esp_http_server/include/http_server.h b/components/esp_http_server/include/http_server.h new file mode 100644 index 0000000000..56f73c5b74 --- /dev/null +++ b/components/esp_http_server/include/http_server.h @@ -0,0 +1,2 @@ +#warning http_server.h has been renamed to esp_http_server.h, please update include directives +#include "esp_http_server.h" diff --git a/components/http_server/src/httpd_priv.h b/components/esp_http_server/src/esp_httpd_priv.h similarity index 99% rename from components/http_server/src/httpd_priv.h rename to components/esp_http_server/src/esp_httpd_priv.h index 7339ec03ef..ff619e39e9 100644 --- a/components/http_server/src/httpd_priv.h +++ b/components/esp_http_server/src/esp_httpd_priv.h @@ -22,8 +22,8 @@ #include #include #include -#include +#include #include "osal.h" #ifdef __cplusplus diff --git a/components/http_server/src/httpd_main.c b/components/esp_http_server/src/httpd_main.c similarity index 99% rename from components/http_server/src/httpd_main.c rename to components/esp_http_server/src/httpd_main.c index 729ec11633..c4bcf68d77 100644 --- a/components/http_server/src/httpd_main.c +++ b/components/esp_http_server/src/httpd_main.c @@ -20,8 +20,8 @@ #include #include -#include -#include "httpd_priv.h" +#include +#include "esp_httpd_priv.h" #include "ctrl_sock.h" static const char *TAG = "httpd"; diff --git a/components/http_server/src/httpd_parse.c b/components/esp_http_server/src/httpd_parse.c similarity index 99% rename from components/http_server/src/httpd_parse.c rename to components/esp_http_server/src/httpd_parse.c index 9a15e2f207..93b5abddc3 100644 --- a/components/http_server/src/httpd_parse.c +++ b/components/esp_http_server/src/httpd_parse.c @@ -18,9 +18,9 @@ #include #include #include -#include -#include "httpd_priv.h" +#include +#include "esp_httpd_priv.h" #include "osal.h" static const char *TAG = "httpd_parse"; diff --git a/components/http_server/src/httpd_sess.c b/components/esp_http_server/src/httpd_sess.c similarity index 99% rename from components/http_server/src/httpd_sess.c rename to components/esp_http_server/src/httpd_sess.c index 2049b2b68e..b3561aab35 100644 --- a/components/http_server/src/httpd_sess.c +++ b/components/esp_http_server/src/httpd_sess.c @@ -17,8 +17,8 @@ #include #include -#include -#include "httpd_priv.h" +#include +#include "esp_httpd_priv.h" static const char *TAG = "httpd_sess"; diff --git a/components/http_server/src/httpd_txrx.c b/components/esp_http_server/src/httpd_txrx.c similarity index 99% rename from components/http_server/src/httpd_txrx.c rename to components/esp_http_server/src/httpd_txrx.c index 1ccebabe4f..5ab80295d2 100644 --- a/components/http_server/src/httpd_txrx.c +++ b/components/esp_http_server/src/httpd_txrx.c @@ -17,8 +17,8 @@ #include #include -#include -#include "httpd_priv.h" +#include +#include "esp_httpd_priv.h" static const char *TAG = "httpd_txrx"; diff --git a/components/http_server/src/httpd_uri.c b/components/esp_http_server/src/httpd_uri.c similarity index 99% rename from components/http_server/src/httpd_uri.c rename to components/esp_http_server/src/httpd_uri.c index b74a7f62a3..9652c9439a 100644 --- a/components/http_server/src/httpd_uri.c +++ b/components/esp_http_server/src/httpd_uri.c @@ -18,8 +18,8 @@ #include #include -#include -#include "httpd_priv.h" +#include +#include "esp_httpd_priv.h" static const char *TAG = "httpd_uri"; diff --git a/components/http_server/src/port/esp32/osal.h b/components/esp_http_server/src/port/esp32/osal.h similarity index 100% rename from components/http_server/src/port/esp32/osal.h rename to components/esp_http_server/src/port/esp32/osal.h diff --git a/components/http_server/src/util/ctrl_sock.c b/components/esp_http_server/src/util/ctrl_sock.c similarity index 100% rename from components/http_server/src/util/ctrl_sock.c rename to components/esp_http_server/src/util/ctrl_sock.c diff --git a/components/http_server/src/util/ctrl_sock.h b/components/esp_http_server/src/util/ctrl_sock.h similarity index 100% rename from components/http_server/src/util/ctrl_sock.h rename to components/esp_http_server/src/util/ctrl_sock.h diff --git a/components/esp_http_server/test/CMakeLists.txt b/components/esp_http_server/test/CMakeLists.txt new file mode 100644 index 0000000000..7587213bda --- /dev/null +++ b/components/esp_http_server/test/CMakeLists.txt @@ -0,0 +1,6 @@ +set(COMPONENT_SRCDIRS ".") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +set(COMPONENT_REQUIRES unity esp_http_server) + +register_component() diff --git a/components/http_server/test/component.mk b/components/esp_http_server/test/component.mk similarity index 100% rename from components/http_server/test/component.mk rename to components/esp_http_server/test/component.mk diff --git a/components/http_server/test/test_http_server.c b/components/esp_http_server/test/test_http_server.c similarity index 99% rename from components/http_server/test/test_http_server.c rename to components/esp_http_server/test/test_http_server.c index 07c91add5c..e343c99ca4 100644 --- a/components/http_server/test/test_http_server.c +++ b/components/esp_http_server/test/test_http_server.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "unity.h" #include "test_utils.h" diff --git a/components/http_server/test/CMakeLists.txt b/components/http_server/test/CMakeLists.txt deleted file mode 100644 index 1c577575ab..0000000000 --- a/components/http_server/test/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(COMPONENT_SRCDIRS ".") -set(COMPONENT_ADD_INCLUDEDIRS ".") - -set(COMPONENT_REQUIRES unity http_server) - -register_component() \ No newline at end of file From 8340ed3ddb34c50336afb9f1a7d706f3a8e4bc8d Mon Sep 17 00:00:00 2001 From: Anurag Kar Date: Wed, 24 Oct 2018 15:22:15 +0530 Subject: [PATCH 2/4] HTTP Server Examples : Include header esp_http_server.h --- .../protocols/http_server/advanced_tests/main/include/tests.h | 2 +- examples/protocols/http_server/advanced_tests/main/tests.c | 2 +- examples/protocols/http_server/persistent_sockets/main/main.c | 2 +- examples/protocols/http_server/simple/main/main.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/protocols/http_server/advanced_tests/main/include/tests.h b/examples/protocols/http_server/advanced_tests/main/include/tests.h index b412765657..8f5db8ea7b 100644 --- a/examples/protocols/http_server/advanced_tests/main/include/tests.h +++ b/examples/protocols/http_server/advanced_tests/main/include/tests.h @@ -1,7 +1,7 @@ #ifndef __HTTPD_TESTS_H__ #define __HTTPD_TESTS_H__ -#include +#include extern httpd_handle_t start_tests(void); extern void stop_tests(httpd_handle_t hd); diff --git a/examples/protocols/http_server/advanced_tests/main/tests.c b/examples/protocols/http_server/advanced_tests/main/tests.c index 0d7d8327f6..74eb7f62c4 100644 --- a/examples/protocols/http_server/advanced_tests/main/tests.c +++ b/examples/protocols/http_server/advanced_tests/main/tests.c @@ -3,7 +3,7 @@ #include #include -#include +#include #include "tests.h" diff --git a/examples/protocols/http_server/persistent_sockets/main/main.c b/examples/protocols/http_server/persistent_sockets/main/main.c index ea6bea5b27..b353559292 100644 --- a/examples/protocols/http_server/persistent_sockets/main/main.c +++ b/examples/protocols/http_server/persistent_sockets/main/main.c @@ -13,7 +13,7 @@ #include #include -#include +#include /* An example to demonstrate persistent sockets, with context maintained across * multiple requests on that socket. diff --git a/examples/protocols/http_server/simple/main/main.c b/examples/protocols/http_server/simple/main/main.c index 5c8d266a59..d4b7b3869e 100644 --- a/examples/protocols/http_server/simple/main/main.c +++ b/examples/protocols/http_server/simple/main/main.c @@ -14,7 +14,7 @@ #include #include -#include +#include /* A simple example that demonstrates how to create GET and POST * handlers for the web server. From 12b60c51be8dcc28823e75ea4e88615717fd12b8 Mon Sep 17 00:00:00 2001 From: Anurag Kar Date: Wed, 24 Oct 2018 15:25:04 +0530 Subject: [PATCH 3/4] HTTP Server Docs : Replace http_server with esp_http_server --- docs/Doxyfile | 2 +- .../protocols/{http_server.rst => esp_http_server.rst} | 4 ++-- docs/en/api-reference/protocols/index.rst | 2 +- docs/zh_CN/api-reference/protocols/esp_http_server.rst | 1 + docs/zh_CN/api-reference/protocols/http_server.rst | 1 - 5 files changed, 5 insertions(+), 5 deletions(-) rename docs/en/api-reference/protocols/{http_server.rst => esp_http_server.rst} (98%) create mode 100644 docs/zh_CN/api-reference/protocols/esp_http_server.rst delete mode 100644 docs/zh_CN/api-reference/protocols/http_server.rst diff --git a/docs/Doxyfile b/docs/Doxyfile index 9fc3e28c11..aaee15e0de 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -97,7 +97,7 @@ INPUT = \ ## mDNS ../../components/mdns/include/mdns.h \ ../../components/esp_http_client/include/esp_http_client.h \ - ../../components/http_server/include/http_server.h \ + ../../components/esp_http_server/include/esp_http_server.h \ ## ## Provisioning - API Reference ## diff --git a/docs/en/api-reference/protocols/http_server.rst b/docs/en/api-reference/protocols/esp_http_server.rst similarity index 98% rename from docs/en/api-reference/protocols/http_server.rst rename to docs/en/api-reference/protocols/esp_http_server.rst index 320dee3f86..24767e934c 100644 --- a/docs/en/api-reference/protocols/http_server.rst +++ b/docs/en/api-reference/protocols/esp_http_server.rst @@ -81,7 +81,7 @@ Application Example /* Generate default configuration */ httpd_config_t config = HTTPD_DEFAULT_CONFIG(); - /* Empty handle to http_server */ + /* Empty handle to esp_http_server */ httpd_handle_t server = NULL; /* Start the httpd server */ @@ -154,4 +154,4 @@ Check the example under :example:`protocols/http_server/persistent_sockets`. API Reference ------------- -.. include:: /_build/inc/http_server.inc +.. include:: /_build/inc/esp_http_server.inc diff --git a/docs/en/api-reference/protocols/index.rst b/docs/en/api-reference/protocols/index.rst index 73bb441c43..fff67481f3 100644 --- a/docs/en/api-reference/protocols/index.rst +++ b/docs/en/api-reference/protocols/index.rst @@ -7,7 +7,7 @@ Protocols API mDNS ESP-TLS HTTP Client - HTTP Server + HTTP Server ASIO ESP-MQTT Modbus slave diff --git a/docs/zh_CN/api-reference/protocols/esp_http_server.rst b/docs/zh_CN/api-reference/protocols/esp_http_server.rst new file mode 100644 index 0000000000..7470556aa4 --- /dev/null +++ b/docs/zh_CN/api-reference/protocols/esp_http_server.rst @@ -0,0 +1 @@ +.. include:: ../../../en/api-reference/protocols/esp_http_server.rst diff --git a/docs/zh_CN/api-reference/protocols/http_server.rst b/docs/zh_CN/api-reference/protocols/http_server.rst deleted file mode 100644 index d1b6fc4d88..0000000000 --- a/docs/zh_CN/api-reference/protocols/http_server.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../../en/api-reference/protocols/http_server.rst From e2b1ae259dfef10029ac46b4f4b3a8a7aea97bc4 Mon Sep 17 00:00:00 2001 From: Anurag Kar Date: Wed, 24 Oct 2018 15:39:43 +0530 Subject: [PATCH 4/4] Protocomm : Use esp_http_server instead of http_server --- components/protocomm/CMakeLists.txt | 2 +- components/protocomm/src/transports/protocomm_httpd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/protocomm/CMakeLists.txt b/components/protocomm/CMakeLists.txt index a6609e5aa5..ec3a7365ba 100644 --- a/components/protocomm/CMakeLists.txt +++ b/components/protocomm/CMakeLists.txt @@ -12,7 +12,7 @@ set(COMPONENT_SRCS "src/common/protocomm.c" "src/transports/protocomm_console.c" "src/transports/protocomm_httpd.c") -set(COMPONENT_PRIV_REQUIRES protobuf-c mbedtls console http_server bt) +set(COMPONENT_PRIV_REQUIRES protobuf-c mbedtls console esp_http_server bt) if(CONFIG_BT_ENABLED) if(CONFIG_BLUEDROID_ENABLED) diff --git a/components/protocomm/src/transports/protocomm_httpd.c b/components/protocomm/src/transports/protocomm_httpd.c index e8d2466032..a7c9b5599e 100644 --- a/components/protocomm/src/transports/protocomm_httpd.c +++ b/components/protocomm/src/transports/protocomm_httpd.c @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include