File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,6 +95,13 @@ Or the following command to update an existing version:
9595
9696 circup update
9797
98+ Security
99+ ========
100+
101+ The HTTP server implementation in this package is not robust and should only be deployed on trusted networks.
102+ For instance, there are trivial denial of service attacks against adafruit_httpserver.
103+ Pull requests that improve the server's security and robustness are of course welcome.
104+
98105Contributing
99106============
100107
Original file line number Diff line number Diff line change 1- Simple file serving
1+ Simple Test
22-------------------
33
4- Serving the content of index.html from the filesystem .
4+ Serving a simple static text message .
55
6- .. literalinclude :: ../examples/httpserver_simple_serve .py
7- :caption: examples/httpserver_simple_serve .py
6+ .. literalinclude :: ../examples/httpserver_simpletest .py
7+ :caption: examples/httpserver_simpletest .py
88 :linenos:
99
1010If you want your code to do more than just serve web pages,
Original file line number Diff line number Diff line change 2727@server .route ("/" )
2828def base (request : HTTPRequest ):
2929 """
30- Serve the default index.html file .
30+ Serve a default static plain text message .
3131 """
32- with HTTPResponse (request , content_type = MIMEType .TYPE_HTML ) as response :
33- response .send_file ("index.html" )
32+ with HTTPResponse (request , content_type = MIMEType .TYPE_TXT ) as response :
33+ message = "Hello from the CircuitPython HTTPServer!"
34+ response .send (message )
3435
3536
3637print (f"Listening on http://{ wifi .radio .ipv4_address } :80" )
You can’t perform that action at this time.
0 commit comments