forked from me-no-dev/ESPAsyncWebServer
This re-enables previously removed WebSocket authentication which is … (#272)
* This re-enables previously removed WebSocket authentication which is orginaly implemented PR #143 * Update README.md
This commit is contained in:
@@ -173,7 +173,7 @@ To use this library you might need to have the latest git versions of [ESP32](ht
|
|||||||
- [VZero](https://github.com/andig/vzero) - the Wireless zero-config controller for volkszaehler.org
|
- [VZero](https://github.com/andig/vzero) - the Wireless zero-config controller for volkszaehler.org
|
||||||
- [ESPurna](https://bitbucket.org/xoseperez/espurna) - ESPurna ("spark" in Catalan) is a custom C firmware for ESP8266 based smart switches. It was originally developed with the ITead Sonoff in mind.
|
- [ESPurna](https://bitbucket.org/xoseperez/espurna) - ESPurna ("spark" in Catalan) is a custom C firmware for ESP8266 based smart switches. It was originally developed with the ITead Sonoff in mind.
|
||||||
- [fauxmoESP](https://bitbucket.org/xoseperez/fauxmoesp) - Belkin WeMo emulator library for ESP8266.
|
- [fauxmoESP](https://bitbucket.org/xoseperez/fauxmoesp) - Belkin WeMo emulator library for ESP8266.
|
||||||
- [ESP-RFID] (https://github.com/omersiar/esp-rfid) - MFRC522 RFID Access Control Management project for ESP8266.
|
- [ESP-RFID](https://github.com/omersiar/esp-rfid) - MFRC522 RFID Access Control Management project for ESP8266.
|
||||||
|
|
||||||
## Request Variables
|
## Request Variables
|
||||||
|
|
||||||
@@ -1365,4 +1365,4 @@ webServer.onNotFound([](AsyncWebServerRequest *request) {
|
|||||||
request->send(404);
|
request->send(404);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
@@ -1098,6 +1098,9 @@ void AsyncWebSocket::handleRequest(AsyncWebServerRequest *request){
|
|||||||
request->send(400);
|
request->send(400);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if((_username != "" && _password != "") && !request->authenticate(_username.c_str(), _password.c_str())){
|
||||||
|
return request->requestAuthentication();
|
||||||
|
}
|
||||||
AsyncWebHeader* version = request->getHeader(WS_STR_VERSION);
|
AsyncWebHeader* version = request->getHeader(WS_STR_VERSION);
|
||||||
if(version->value().toInt() != 13){
|
if(version->value().toInt() != 13){
|
||||||
AsyncWebServerResponse *response = request->beginResponse(400);
|
AsyncWebServerResponse *response = request->beginResponse(400);
|
||||||
|
Reference in New Issue
Block a user