8000 Add files via upload · Lackmann1994/esp32_https_server@b4d0efc · GitHub
[go: up one dir, main page]

Skip to content

Commit b4d0efc

Browse files
authored
Add files via upload
1 parent 3c58e30 commit b4d0efc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

https_server.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ void testCallback(HTTPRequest * req, HTTPResponse * res) {
2222
res->println("<!DOCTYPE html>");
2323
res->println("<html>");
2424
res->println("<head>");
25-
res->println("<title>HTTPS Server on ESP32</title>");
25+
if (res->_con->ssl()) // test if connection is encrypted
26+
res->println("<title>HTTPS Server on ESP32</title>");
27+
else
28+
res->println("<title>HTTP Server on ESP32</title>");
2629
res->println("</head>");
2730
res->println("<body>");
28-
res->println("<h1>Hello world!</h1>");
31+
if (res->_con->ssl()) // test if connection is encrypted
32+
res->println("<h1>Hello HTTPS world!</h1>");
33+
else
34+
res->println("<h1>Hello HTTP world!</h1>");
2935
res->println("<p>... from your ESP32</p>");
3036
// The image resource is created in the awesomeCallback some lines below
3137
res->println("<img src=\"images/awesome.svg\" alt=\"Awesome face\" style=\"width:250px;\" />");
@@ -333,4 +339,4 @@ void serverTask(void *params) {
333339
ESP.restart();
334340
}
335341

336-
}
342+
}

0 commit comments

Comments
 (0)
0