Replies: 1 comment
-
Now I added HTML with Login (line 93) and a password handler (line 796). Now I get a login windows, but after that nothing happens. Could someone advise what is missing? `// Original Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD #include <esp_http_server.h> #include "index_ov2640.h" // Functions from the main .ino // External variables declared in the main .ino typedef struct { #define PART_BOUNDARY "123456789000000000000987654321" httpd_handle_t stream_httpd = NULL; // Flag that can be set to kill all active streams #ifdef __cplusplus "" "" "" " " " " "" "" "" "" "" " " " " "" "" "" " " " " "" "" "" "" "
"" "<script>" "function check(form)" "{" "if(form.userid.value=='admin' && form.pwd.value=='admin')" "{" "window.open('/')" "}" "else" "{" " alert('Error Password or Username')/displays error message/" "}" "}" "</script>";* void serialDump() { static esp_err_t capture_handler(httpd_req_t *req){
} static esp_err_t stream_handler(httpd_req_t *req){
} static esp_err_t cmd_handler(httpd_req_t req){
} static esp_err_t status_handler(httpd_req_t *req){ static esp_err_t info_handler(httpd_req_t *req){ static esp_err_t favicon_16x16_handler(httpd_req_t *req){ static esp_err_t favicon_32x32_handler(httpd_req_t *req){ static esp_err_t favicon_ico_handler(httpd_req_t *req){ static esp_err_t logo_svg_handler(httpd_req_t *req){ static esp_err_t dump_handler(httpd_req_t *req){ \n", critERR.c_str()); } d+= sprintf(d," ESP32 Cam Webserver\n");// Module d+= sprintf(d,"Name: %s \n", myName); d+= sprintf(d,"Firmware: %s (base: %s) \n", myVer, baseVersion); float sketchPct = 100 * sketchSize / sketchSpace; d+= sprintf(d,"Sketch Size: %i (total: %i, %.1f%% used) \n", sketchSize, sketchSpace, sketchPct); d+= sprintf(d,"MD5: %s \n", sketchMD5.c_str()); d+= sprintf(d,"ESP sdk: %s \n", ESP.getSdkVersion()); // Network d+= sprintf(d," WiFi\n");if (accesspoint) { if (captivePortal) { d+= sprintf(d,"Mode: AccessPoint with captive portal \n"); } else { d+= sprintf(d,"Mode: AccessPoint \n"); } d+= sprintf(d,"SSID: %s \n", apName); } else { d+= sprintf(d,"Mode: Client \n"); String ssidName = WiFi.SSID(); d+= sprintf(d,"SSID: %s \n", ssidName.c_str()); d+= sprintf(d,"Rssi: %i \n", WiFi.RSSI()); String bssid = WiFi.BSSIDstr(); d+= sprintf(d,"BSSID: %s \n", bssid.c_str()); } d+= sprintf(d,"IP address: %d.%d.%d.%d \n", ip[0], ip[1], ip[2], ip[3]); if (!accesspoint) { d+= sprintf(d,"Netmask: %d.%d.%d.%d \n", net[0], net[1], net[2], net[3]); d+= sprintf(d,"Gateway: %d.%d.%d.%d \n", gw[0], gw[1], gw[2], gw[3]); } d+= sprintf(d,"Http port: %i, Stream port: %i \n", httpPort, streamPort); byte mac[6]; WiFi.macAddress(mac); d+= sprintf(d,"MAC: %02X:%02X:%02X:%02X:%02X:%02X \n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
} static esp_err_t stop_handler(httpd_req_t req){ static esp_err_t style_handler(httpd_req_t *req){ static esp_err_t streamviewer_handler(httpd_req_t *req){ static esp_err_t error_handler(httpd_req_t *req){
} void startCameraServer(int hPort, int sPort){ //try HTTP Auth
}` |
Beta Was this translation helpful? Give feedback.
-
Hello,
has anyone added HTTP authentcation to the V4.0?
Could someone help a beginner to realize that?
Problem is, that the stream and webserver is open for everybody in my network. For sure it is not 100% safe for real intruders, but it would let me sleep a little better ;-)
Beta Was this translation helpful? Give feedback.
All reactions