e2da1d9905
This introduces the following changes in the example test scripts : * Dependency on python requests library removed in favor of httplib * Bug fixed in the logic responsible for receiving and processing http chunked responses * Default timeouts increased Note : Due to connectivity issues (between runner host and DUT) in the runner environment, some of the advanced_tests are being ignored. These tests are intended for verifying the expected limits of the http_server capabilities, and implement sending and receiving of large HTTP packets and malformed requests, running multiple parallel sessions, etc. It is advised that all these tests be run locally, when making changes or adding new features to this component. |
||
---|---|---|
.. | ||
main | ||
scripts | ||
http_server_simple_test.py | ||
Makefile | ||
README.md |
Simple HTTPD Server Example
The Example consists of HTTPD server demo with demostration of URI handling : 1. URI \hello for GET command returns "Hello World!" message 2. URI \echo for POST command echoes back the POSTed message
-
Configure the project using "make menuconfig" and goto :
- Example Configuration ->
- WIFI SSID: WIFI network to which your PC is also connected to.
- WIFI Password: WIFI password
- Example Configuration ->
-
In order to test the HTTPD server persistent sockets demo :
- compile and burn the firmware "make flash"
- run "make monitor" and note down the IP assigned to your ESP module. The default port is 80
- test the example :
- run the test script : "python2 scripts/client.py <IP> <port> <MSG>"
- the provided test script first does a GET \hello and displays the response
- the script does a POST to \echo with the user input <MSG> and displays the response
- or use curl (asssuming IP is 192.168.43.130):
- "curl 192.168.43.130:80/hello" - tests the GET "\hello" handler
- "curl -X POST --data-binary @anyfile 192.168.43.130:80/echo > tmpfile"
- "anyfile" is the file being sent as request body and "tmpfile" is where the body of the response is saved
- since the server echoes back the request body, the two files should be same, as can be confirmed using : "cmp anyfile tmpfile"
- "curl -X PUT -d "0" 192.168.43.130:80/ctrl" - disable /hello and /echo handlers
- "curl -X PUT -d "1" 192.168.43.130:80/ctrl" - enable /hello and /echo handlers
- run the test script : "python2 scripts/client.py <IP> <port> <MSG>"
See the README.md file in the upper level 'examples' directory for more information about examples.