• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

main/11-Mar-2024-308201

CMakeLists.txtD11-Mar-2024455 118

MakefileD11-Mar-2024265 113

README.mdD11-Mar-20241.7 KiB2520

http_server_simple_test.pyD11-Mar-20246.3 KiB173103

README.md

1# Simple HTTPD Server Example
2
3The Example consists of HTTPD server demo with demostration of URI handling :
4    1. URI \hello for GET command returns "Hello World!" message
5    2. URI \echo for POST command echoes back the POSTed message
6
7* Open the project configuration menu (`idf.py menuconfig`) to configure Wi-Fi or Ethernet. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../../README.md) for more details.
8
9* In order to test the HTTPD server persistent sockets demo :
10    1. compile and burn the firmware `idf.py -p PORT flash`
11    2. run `idf.py -p PORT monitor` and note down the IP assigned to your ESP module. The default port is 80
12    3. test the example :
13        * run the test script : "python scripts/client.py \<IP\> \<port\> \<MSG\>"
14            * the provided test script first does a GET \hello and displays the response
15            * the script does a POST to \echo with the user input \<MSG\> and displays the response
16        * or use curl (asssuming IP is 192.168.43.130):
17            1. "curl 192.168.43.130:80/hello"  - tests the GET "\hello" handler
18            2. "curl -X POST --data-binary @anyfile 192.168.43.130:80/echo > tmpfile"
19                * "anyfile" is the file being sent as request body and "tmpfile" is where the body of the response is saved
20                * since the server echoes back the request body, the two files should be same, as can be confirmed using : "cmp anyfile tmpfile"
21            3. "curl -X PUT -d "0" 192.168.43.130:80/ctrl" - disable /hello and /echo handlers
22            4. "curl -X PUT -d "1" 192.168.43.130:80/ctrl" -  enable /hello and /echo handlers
23
24See the README.md file in the upper level 'examples' directory for more information about examples.
25