mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-09-28 23:30:55 +02:00
Manually merged changes from BlueAndy fork
Minor updates of my custom stuff
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -673,10 +673,22 @@ void setup(){
|
||||
if(!request->authenticate(http_username, http_password)) return request->requestAuthentication();
|
||||
#endif
|
||||
request->onDisconnect([]() {
|
||||
WiFi.disconnect(true);
|
||||
#ifdef ESP32
|
||||
/*
|
||||
//https://github.com/espressif/arduino-esp32/issues/400#issuecomment-499631249
|
||||
//WiFi.disconnect(true); // doesn't work on esp32, below needs #include "esp_wifi.h"
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); //load the flash-saved configs
|
||||
esp_wifi_init(&cfg); //initiate and allocate wifi resources (does not matter if connection fails)
|
||||
if(esp_wifi_restore()!=ESP_OK){
|
||||
Serial.print(F("WiFi is not initialized by esp_wifi_init "));
|
||||
} else {
|
||||
Serial.print(F("WiFi Configurations Cleared!"));
|
||||
}
|
||||
*/
|
||||
WiFi.disconnect(true, true); // Works on esp32
|
||||
ESP.restart();
|
||||
#elif defined(ESP8266)
|
||||
WiFi.disconnect(true);
|
||||
ESP.reset();
|
||||
#endif
|
||||
});
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -664,9 +664,9 @@ void AsyncWebSocketClient::_onData(void *pbuf, size_t plen){
|
||||
if(_pinfo.opcode){
|
||||
_pinfo.message_opcode = _pinfo.opcode;
|
||||
_pinfo.num = 0;
|
||||
} else _pinfo.num += 1;
|
||||
}
|
||||
_server->_handleEvent(this, WS_EVT_DATA, (void *)&_pinfo, (uint8_t*)data, datalen);
|
||||
}
|
||||
if (datalen > 0) _server->_handleEvent(this, WS_EVT_DATA, (void *)&_pinfo, (uint8_t*)data, datalen);
|
||||
|
||||
_pinfo.index += datalen;
|
||||
} else if((datalen + _pinfo.index) == _pinfo.len){
|
||||
@@ -694,6 +694,8 @@ void AsyncWebSocketClient::_onData(void *pbuf, size_t plen){
|
||||
_server->_handleEvent(this, WS_EVT_PONG, NULL, data, datalen);
|
||||
} else if(_pinfo.opcode < 8){//continuation or text/binary frame
|
||||
_server->_handleEvent(this, WS_EVT_DATA, (void *)&_pinfo, data, datalen);
|
||||
if (_pinfo.final) _pinfo.num = 0;
|
||||
else _pinfo.num += 1;
|
||||
}
|
||||
} else {
|
||||
//os_printf("frame error: len: %u, index: %llu, total: %llu\n", datalen, _pinfo.index, _pinfo.len);
|
||||
|
@@ -192,8 +192,16 @@ void AsyncWebServerRequest::_removeNotInterestingHeaders(){
|
||||
|
||||
void AsyncWebServerRequest::_onPoll(){
|
||||
//os_printf("p\n");
|
||||
if(_response != NULL && _client != NULL && _client->canSend() && !_response->_finished()){
|
||||
if(_response != NULL && _client != NULL && _client->canSend()){
|
||||
if(!_response->_finished()){
|
||||
_response->_ack(this, 0, 0);
|
||||
} else {
|
||||
AsyncWebServerResponse* r = _response;
|
||||
_response = NULL;
|
||||
delete r;
|
||||
|
||||
_client->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,10 +210,13 @@ void AsyncWebServerRequest::_onAck(size_t len, uint32_t time){
|
||||
if(_response != NULL){
|
||||
if(!_response->_finished()){
|
||||
_response->_ack(this, len, time);
|
||||
} else {
|
||||
}
|
||||
if(_response->_finished()){
|
||||
AsyncWebServerResponse* r = _response;
|
||||
_response = NULL;
|
||||
delete r;
|
||||
|
||||
_client->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//File: edit.htm.gz, Size: 4503
|
||||
#define edit_htm_gz_len 4503
|
||||
const uint8_t edit_htm_gz[] PROGMEM = {
|
||||
0x1F,0x8B,0x08,0x08,0x66,0x6B,0x3D,0x5F,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5,
|
||||
0x1F,0x8B,0x08,0x08,0x54,0x90,0x4A,0x5F,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5,
|
||||
0x1A,0x0B,0x5B,0xDB,0x36,0xF0,0xAF,0x18,0x6F,0x63,0xF6,0xE2,0x38,0x0E,0x50,0xD6,0x3A,0x18,0x16,0x1E,
|
||||
0xEB,0xBB,0x50,0x12,0xDA,0xD1,0x8E,0xED,0x53,0x6C,0x25,0x56,0xB1,0x25,0xCF,0x96,0x09,0x34,0xCD,0x7F,
|
||||
0xDF,0x49,0xF2,0x93,0x84,0xEE,0xF1,0x6D,0xA5,0x60,0x49,0xA7,0x3B,0xDD,0x9D,0xEE,0x25,0xD9,0x7B,0x1B,
|
||||
|
Reference in New Issue
Block a user