Skip to content

Commit

Permalink
Upload http-server 1.1.1.464
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlab-runner committed Oct 5, 2020
1 parent c3dc3a1 commit b371ce9
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 230 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It supports RESTful methods such as GET, PUT, and POST for the client to communi
* Secure [with TLS security] and non-secure modes of connection.
* Supports RESTful HTTP methods: GET, PUT, and POST.
* Handles various resource content types such as HTML, Plain, and JSON.
* Capable of handling content payload greater than the MTU size using the Content-Length HTTP header. This feature is supported only for `CY_RAW_DYNAMIC_URL_CONTENT` and `CY_DYNAMIC_URL_CONTENT` content types
* Capable of handling content payload greater than the MTU size using the Content-Length HTTP header. This feature is supported only for `CY_RAW_DYNAMIC_URL_CONTENT` and `CY_DYNAMIC_URL_CONTENT` content types.
* Supports chunked encoding for GET and POST methods.
**Note:** For a POST request, chunked encoding is supported only for the data that is less than a single MTU; Content-Length headers are recommended for larger data.
* Supports Server-Sent Events (SSE). SSE is a server push technology, enabling an HTTP client (for example, a browser or any device running an HTTP client) to receive automatic updates from the HTTP server via the HTTP connection.
Expand All @@ -35,7 +35,7 @@ This section provides the list of dependent libraries required for this middlewa
* [Wi-Fi Middleware Core](https://github.com/cypresssemiconductorco/wifi-mw-core)

### Mbed OS
* [Arm Mbed OS Stack version 5.15.3](https://os.mbed.com/mbed-os/releases)
* [Arm Mbed OS 6.2.0](https://os.mbed.com/mbed-os/releases)
* [Connectivity Utilities Library](https://github.com/cypresssemiconductorco/connectivity-utilities)

## Quick Start
Expand Down Expand Up @@ -75,3 +75,4 @@ This library is supported on both AnyCloud and Mbed OS frameworks. The section b
* [HTTP Server RELEASE.md](./RELEASE.md)
* [HTTP Server API Reference Guide](https://cypresssemiconductorco.github.io/http-server/api_reference_manual/html/index.html)
* [HTTP Server Library Version](./version.txt)

22 changes: 12 additions & 10 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# HTTP Server Library

### What's Included?
## What's Included?
Refer to the [README.md](./README.md) for a complete description of the HTTP server library.

## Known Issues
| Problem | Workaround |
| ------- | ---------- |
| The implementation of newlib from GCC will leak ~1.4kb of heap memory per task/thread that uses stdio functions (i.e. printf, snprintf, etc.) | By default, log messages are disabled in the HTTP server library. Refer to the [README.md](./README.md) for enabling log messages. It is recommended to enable log messages, only for debugging purposes |
| If the HTTP server is stopped while connected to certain clients (such as some browsers), then a duration of approximately 2-3 minutes needs to elapse (TCP wait time) prior to re-starting the HTTP server again (or it could result in socket bind to fail). | None |
| On memory constrained devices (such as CY8CKIT_062_WIFI_BT), there could be a limit on the max number of simultaneous secure connections. | None |

## Changelog
### v1.1.1
* Updates to support mbed-os 6.2 version

### v1.1.0
* Introduced C APIs for AnyCloud framework.
Expand All @@ -21,12 +27,8 @@ Refer to the [README.md](./README.md) for a complete description of the HTTP ser
### v1.0.0
* This is the first version of HTTP server library.

### Known Issues
- If the HTTP server is stopped, while connected to certain clients (such as some browsers), then a duration of approximately 2-3 minutes needs to elapse (TCP wait time) prior to re-starting the HTTP server again (or it could result in socket bind to fail).
- On memory constrained devices (such as CY8CKIT_062_WIFI_BT), there could be a limit on the max number of simultaneous secure connections.

### Supported Software and Tools
This version of the library was validated for compatibility with the following Software and Tools:
## Supported Software and Tools
The current version of the library was validated for compatibility with the following Software and Tools:

| Software and Tools | Version |
| :--- | :----: |
Expand All @@ -36,6 +38,6 @@ This version of the library was validated for compatibility with the following S
| - ModusToolbox CapSense Configurator / Tuner tools | 3.0 |
| PSoC 6 Peripheral Driver Library (PDL) | 1.5.1 |
| GCC Compiler | 9.2.1 |
| IAR Compiler | 8.32 |
| Arm Compiler 6 | 6.13 |
| MBED OS | 5.15.3 |
| IAR Compiler (only for AnyCloud) | 8.32 |
| Arm Compiler 6 | 6.14 |
| MBED OS | 6.2.0 |
56 changes: 32 additions & 24 deletions docs/api_reference_manual/html/index.html

Large diffs are not rendered by default.

139 changes: 0 additions & 139 deletions include/cy_http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,145 +39,6 @@
*/


/**
********************************************************************************
* \mainpage Overview
********************************************************************************
* This library provides the HTTP Server implementation that can work on the PSoC 6 MCU platforms with Wi-Fi connectivity.
* It supports RESTful methods such as GET, PUT, and POST for the client to communicate with this HTTP Server library.
*
* \section section_features Features
* Following are the features supported by this library:
* * Secure [with TLS security] and non-secure modes of connection.
* * RESTful HTTP methods: GET, PUT, and POST.
* * Various resource content types such as HTML, Plain, and JSON.
* * Content payload greater than the MTU size using the Content-Length HTTP header. This feature is supported only for CY_RAW_DYNAMIC_URL_CONTENT and CY_DYNAMIC_URL_CONTENT content types.
* * Chunked encoding for GET and POST methods.
* > Note: For POST requests, chunked encoding is supported only for data that is less than a single MTU; Content-Length headers are recommended for larger data.
* * Server-Sent Events (SSE). SSE is a server push technology, enabling an HTTP client (for example, a browser or any device running an HTTP client) to receive automatic updates from the HTTP server via the HTTP connection.
*
* \section section_platforms Supported Platforms
* * [PSoC 6 WiFi-BT Prototyping Kit (CY8CPROTO-062-4343W)](https://www.cypress.com/documentation/development-kitsboards/psoc-6-wi-fi-bt-prototyping-kit-cy8cproto-062-4343w)
* * [PSoC 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WiFi-BT)](https://www.cypress.com/documentation/development-kitsboards/psoc-6-wifi-bt-pioneer-kit-cy8ckit-062-wifi-bt)
* * [PSoC 62S2 Wi-Fi BT Pioneer Kit (CY8CKIT-062S2-43012)](https://www.cypress.com/documentation/development-kitsboards/psoc-62s2-wi-fi-bt-pioneer-kit-cy8ckit-062s2-43012)
*
* \section section_frameworks Supported Frameworks
* This middleware library supports the following frameworks:
* * AnyCloud Framework : AnyCloud is a FreeRTOS-based solution. HTTP server library uses the [abstraction-rtos](https://github.com/cypresssemiconductorco/abstraction-rtos) library that provides the RTOS abstraction API and uses the [secure-sockets](https://github.com/cypresssemiconductorco/secure-sockets) library for implementing socket functions.
* * Mbed framework: Mbed framework is a Mbed OS-based solution. HTTP server library uses the [abstraction-rtos](https://github.com/cypresssemiconductorco/abstraction-rtos) library that provides RTOS abstraction API and uses the Mbed socket API for implementing socket functions.
*
* \section section_dependencies Dependencies
* This HTTP Server library depends on the following libraries. All these libraries are included by default.
* \subsection section_anycloud AnyCloud
* * [Wi-Fi Middleware Core](https://github.com/cypresssemiconductorco/wifi-mw-core)
*
* \subsection section_mbed Mbed OS
* * [Arm Mbed OS stack version 5.15.3](https://os.mbed.com/mbed-os/releases)
* * [Connectivity Utilities Library](https://github.com/cypresssemiconductorco/connectivity-utilities)
*
* \section section_quick_start Quick Start
* This library is supported on both AnyCloud and Mbed OS frameworks. The following section provides information on how to build the library in those framework
* \subsection framework_1 AnyCloud
* * A set of pre-defined configuration files have been bundled with the wifi-mw-core library for FreeRTOS, lwIP, and mbed TLS. You should review the configuration and make the required adjustments. See the "Quick Start" section in <a href="https://github.com/cypresssemiconductorco/wifi-mw-core/blob/master/README.md">README.md</a>
* * A set of COMPONENTS must be defined in the application's makefile for the HTTP Server Library. See the "Quick Start" section in <a href="https://github.com/cypresssemiconductorco/wifi-mw-core/blob/master/README.md">README.md</a>
* * HTTP Server Library disables all the debug log messages by default. To enable log messages, the application must perform the following:
* -# Add `ENABLE_HTTP_SERVER_LOGS` macro to the *DEFINES* in the code example's Makefile. The Makefile entry would look like as follows:
* \code
* DEFINES+=ENABLE_HTTP_SERVER_LOGS
* \endcode
* -# Call the `cy_log_init()` function provided by the *cy-log* module. cy-log is part of the *connectivity-utilities* library. See [connectivity-utilities library API documentation](https://cypresssemiconductorco.github.io/connectivity-utilities/api_reference_manual/html/group__logging__utils.html) for cy-log details.
* * Define the below macro in application Makefile to configure maximum number of HTTP server resource :
* ```
* MAX_NUMBER_OF_HTTP_SERVER_RESOURCES
* ```
*
* \subsection framework_2 Mbed OS
* * HTTP Server Library disables all the debug log messages by default. To enable log messages, the application must perform the following:
* -# Add `ENABLE_HTTP_SERVER_LOGS` macro to the *DEFINES* in the code example's JSON file. The JSON file entry would look like as follows:
* \code
* "macros": ["ENABLE_HTTP_SERVER_LOGS"],
* \endcode
* -# Call the `cy_log_init()` function provided by the *cy-log* module. cy-log is part of the *connectivity-utilities* library. See [connectivity-utilities library API documentation](https://cypresssemiconductorco.github.io/connectivity-utilities/api_reference_manual/html/group__logging__utils.html) for cy-log details.
* * Define the following macro in the application JSON file to configure the maximum number of HTTP server resources:
* ```
* MAX_NUMBER_OF_HTTP_SERVER_RESOURCES
* ```
*
********************************************************************************
* \section section_code_snippet Code Snippets
********************************************************************************
* This section provides code snippets for this library on AnyCloud and Mbed OS frameworks. The code snippets given under the AnyCloud section uses C APIs, whereas the snippets
* given under Mbed OS use C++ Class to demonstrate the library usage. In general, the library features are tested on Mbed OS using C++ Class interface, and tested on AnyCloud using C APIs.
* * AnyCloud - Snippets for HTTP Server create, start, stop, and delete (C implementation).
* * Mbed OS - Snippets for HTTP server create, start, stop, and delete (C++ implementation).
*
********************************************************************************
* \section section_code_snippet_AnyCloud AnyCloud
********************************************************************************
********************************************************************************
* These code snippets demonstrate the initialization of the configuration structures required for the operation such as creating a secure or non-secure connection and registering a static or dynamic resource with the HTTP server.
* \subsection snip1 Code Snippet 1: Creation and Initialization of Handle for Non-Secure HTTP Server
* Creates an HTTP server handle for a non-secure HTTP connection using the \ref cy_http_server_create API function.
* \snippet doxygen_http_code_snippet.c snippet_http_non_secure_create
* \subsection snip2 Code Snippet 2: Creation and Initialization of Handle for Secure HTTP Server
* Creates an HTTP server handle for a secure HTTP connection using the \ref cy_http_server_create API function.
* \snippet doxygen_http_code_snippet.c snippet_http_secure_create
* \subsection snip3 Code Snippet 3: Registering a Static Resource
* Registers a static resource with the HTTP server using the \ref cy_http_server_register_resource API function.
* \snippet doxygen_http_code_snippet.c snippet_http_static_reg_resource
* \subsection snip4 Code Snippet 4: Registering a Dynamic Resource
* Registers a dynamic resource with the HTTP server using the \ref cy_http_server_register_resource API function.
* \snippet doxygen_http_code_snippet.c snippet_http_dynamic_reg_resource
* \subsection snip5 Code Snippet 5: Registering a Server-Sent Event (SSE)
* Registers a Server-Sent Event using the \ref cy_http_server_register_resource API function.
* \snippet doxygen_http_code_snippet.c snippet_http_server_event_reg
* \subsection snip6 Code Snippet 6: HTTP Server Start
* Starts the HTTP server using the \ref cy_http_server_start API function.
* \snippet doxygen_http_code_snippet.c snippet_http_server_start
* \subsection snip7 Code Snippet 7: Sending HTTP Server Events
* Sends HTTP server events using the \ref cy_http_server_response_stream_write_header API function.
* \snippet doxygen_http_code_snippet.c snippet_http_server_send_events
* \subsection snip8 Code Snippet 8: HTTP Server Stop
* Stops the HTTP server using the \ref cy_http_server_stop API function.
* \snippet doxygen_http_code_snippet.c snippet_http_server_stop
* \subsection snip9 Code Snippet 9: HTTP URL query
* Search a key-value pair, fetch the value of a key, and get the number of queries from the given URL using URL-processing functions.
* \snippet doxygen_http_code_snippet.c snippet_http_server_url_query
********************************************************************************
********************************************************************************
* \section section_code_snippet_Mbed Mbed OS
********************************************************************************
********************************************************************************
* These code snippets demonstrate the initialization of the configuration structures required for the operation such as creating a secure or non-secure connection and registering a static or dynamic resource with the HTTP server.
* \subsection snip10 Code Snippet 1: Creation and initialization of a non-secure HTTP server object
* Creates a non-secure HTTP connection using the HTTPServer() constructor.
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_http_non_secure_new
* \subsection snip11 Code Snippet 2: Creation and initialization of a secure HTTP server object
* Creates a secure HTTP connection using the HTTPServer() constructor.
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_http_secure_new
* \subsection snip12 Code Snippet 3: Registering a static resource
* Registers a static resource with the HTTP server using the register_resource() API function.
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_mbed_http_static_reg_resource
* \subsection snip13 Code Snippet 4: Registering a dynamic resource
* Registers a dynamic resource with the HTTP server using the register_resource() API function.
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_mbed_http_dynamic_reg_resource
* \subsection snip14 Code Snippet 5: Registering a Server-Sent Events
* Registers a Server-Sent Events using the register_resource() API function.
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_mbed_http_server_event_reg
* \subsection snip15 Code Snippet 6: HTTP server start
* Starts an HTTP server using the start() API function.
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_mbed_http_server_start
* \subsection snip16 Code Snippet 7: Sending HTTP server events
* Sends HTTP server events using the http_response_stream_write() API function.
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_mbed_http_server_send_events
* \subsection snip17 Code Snippet 8: HTTP server stop
* Stops an HTTP server using the stop() API function.
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_mbed_http_server_stop
* \subsection snip18 Code Snippet 9: HTTP URL query
* Search a key-value pair, fetch the value of a key, and get the number of queries from the given URL using URL-processing functions
* \snippet doxygen_Mbed_http_code_snippet.cpp snippet_mbed_http_server_url_query
********************************************************************************
*/
/**
* \defgroup group_c_api C API
* \defgroup http_server_struct Structures & Enumerations
Expand Down
17 changes: 0 additions & 17 deletions mbed_app.json

This file was deleted.

24 changes: 0 additions & 24 deletions mbedtls_user_config.h

This file was deleted.

13 changes: 1 addition & 12 deletions source/cy_http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,6 @@ cy_rslt_t cy_http_server_create( cy_network_interface_t *interface,
cy_rslt_t cy_http_server_start( cy_http_server_t server_handle )
{
cy_rslt_t result = CY_RSLT_SUCCESS;
cy_resource_static_data_t static_resource;
static_resource.length = 0;
static_resource.data = NULL;
cy_http_server_object_t *server_obj;

if( server_handle == NULL )
Expand All @@ -415,14 +412,6 @@ cy_rslt_t cy_http_server_start( cy_http_server_t server_handle )
return CY_RSLT_ERROR;
}

/* Add static resource to find out the end of the resource list */
result = cy_http_server_register_resource( server_obj, 0, 0, CY_STATIC_URL_CONTENT, &static_resource );
if( result != CY_RSLT_SUCCESS )
{
hs_cy_log_msg( CYLF_MIDDLEWARE, CY_LOG_ERR, "\nRegistration of resource failed" );
return result;
}

if( server_obj->is_secure == true )
{
/* Initialize server certificate & private key */
Expand Down Expand Up @@ -1863,7 +1852,7 @@ cy_rslt_t http_server_find_url_in_page_database( char *url, uint32_t length, cy_
return CY_RSLT_ERROR;
}

while( page_database[ i ].url != NULL )
while( (i < MAX_NUMBER_OF_HTTP_SERVER_RESOURCES) && (page_database[ i ].url != NULL) )
{
if( match_string_with_wildcard_pattern( url, length, page_database[ i ].url ) != 0 )
{
Expand Down
3 changes: 2 additions & 1 deletion source/port/COMPONENT_MBED/cy_tcpip_port_mbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ cy_rslt_t cy_register_disconnect_callback( cy_tcp_socket_t* socket, disconnect_c

cy_rslt_t cy_set_socket_recv_timeout( cy_tcp_socket_t* socket, uint32_t timeout )
{
/* Dummy implementation of cy_set_socket_recv_timeout */
TCPSocket* tcp_socket = (TCPSocket*) socket->socket;
tcp_socket->set_timeout(timeout);
return CY_RSLT_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0.382
1.1.1.464

0 comments on commit b371ce9

Please sign in to comment.