Comments (5)
Hi,
First of all, thank you for your great work on this library.
I'm encountering the same issue here with v1.7.0. It looks like the web server is returning garbage after some valid bytes (see screenshot attached).
The garbage occurrs after:
<!DOCTYPE html><html lang="en"><head><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/><title>Config ESP</title><script>function c(l){document.getElementById('s').value=l.innerText||l.textContent;document.getElementById('p').focus();document.getElementById('s1').value=l.innerText||l.textContent;document.getElementById('p1').focus();}</script><script>(function(e){var t=function(){"use strict";var e="s",n=function(e){var t=-e.getTimezoneOffset();return t!==null?t:0},r=function(e,t,n){var r=new Date;return e!==undefined&&r.setFullYear(e),r.setDate(n),r.setMonth(t),r},i=function(e){return n(r(e,0,2))},s=function(e){return n(r(e,5,2))},o=function(e){var t=e.getMonth()>7?s(e.getFullYear()):i(e.getFullYear()),r=n(e);return t-r!==0},u=function(){var t=i(),n=s(),r=i()-s();return r<0?t+",1":r>0?n+",1,"+e:t+",0"},a=function(){var e=u();return ne
Thanks,
Michael
from espasync_wifimanager.
Hm. It looks like the issue is caused by passing the page
variable of type String
by value.
Replacing
AsyncWebServerResponse *response = request->beginResponse(200, WM_HTTP_HEAD_CT, page);
with
AsyncWebServerResponse *response = request->beginResponse_P(200, WM_HTTP_HEAD_CT, page.c_str());
in
void ESPAsync_WiFiManager::handleWifi(AsyncWebServerRequest *request)
solves the issue for me.
And because there's no need to do memory operations for building the response, we should always use beginResponse_P
and pass the char pointer to avoid string duplication in memory and an oom error.
Unfortunately I don't have the time for a pull request right now, maybe within the next days.
from espasync_wifimanager.
Thanks for using the library.
I've retried many times, using WeMos D1 Mini as well as WeMos D1, ESP3288, etc. but everything is OK.
Starting Async_ConfigOnDoubleReset using LittleFS on ESP8266_WEMOS_D1MINI
ESPAsync_WiFiManager v1.7.1
ESP_DoubleResetDetector v1.1.1
ESP Self-Stored: SSID = HueNet, Pass = password
[WM] * Add SSID = HueNet , PW = password
Got ESP Self-Stored Credentials. Timeout 120s for Config Portal
LittleFS Flag read = 0xD0D01234
doubleResetDetected
Saving config file...
Saving config file OK
Open Config Portal without Timeout: Double Reset Detected
Starting configuration portal @ 192.168.4.1, SSID = ESP_AB1481, PWD = MyESP_AB1481
[WM] Connecting to new AP
WiFi connected...yeey :)
[WM] * Add SSID = HueNet1 , PW = password
[WM] * Add SSID = HueNet2 , PW = password
[WM] SaveWiFiCfgFile
[WM] stationIP = 192.168.2.186 , gatewayIP = 192.168.2.1
[WM] netMask = 255.255.255.0
[WM] dns1IP = 192.168.2.1 , dns2IP = 8.8.8.8
[WM] OK
After waiting 0.00 secs more in setup(), connection result is connected. Local IP: 192.168.2.186
HHH
I think there is something wrong either with your board, your code or your development platform (Visual Code Studio). I suggest you to eliminate the issue one-by-one, by using the standard Arduino IDE v1.8.13 on another ESP8266 board.
You have to know ESP32 is more powerful with larger resource than ESP8266. Therefore code, running on ESP32, can't always run on ESP8266.
I have to close the issue until you prove there is some bug in the library.
Good Luck,
from espasync_wifimanager.
from espasync_wifimanager.
I don't think that is the issue. If you have a look at the ESPAsyncWebServer library #L246-L254
AsyncWebServerResponse *beginResponse(int code, const String& contentType=String(), const String& content=String());
...
AsyncWebServerResponse *beginResponse_P(int code, const String& contentType, PGM_P content, AwsTemplateProcessor callback=nullptr);
The following function call is correct, and String is passed by reference
, not by value (with duplication) as you think.
AsyncWebServerResponse *response = request->beginResponse(200, WM_HTTP_HEAD_CT, page);
The following call to use beginResponse_P
is wrong, unless your page
is PGM_P type (in PROGMEM)
AsyncWebServerResponse *response = request->beginResponse_P(200, WM_HTTP_HEAD_CT, page.c_str());
I suggest you to check your code as well as your usage of your String for heap / stack corruption issue.
from espasync_wifimanager.
Related Issues (20)
- Captive Portal hanging depending on active core for AsyncTCP HOT 6
- Configuration not saved on azdelivery devkit v2 HOT 2
- Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled. HOT 1
- ESPAsyncDNSServer depends on faulty and not maintained library ESPAsyncUDP HOT 17
- ESP32C3 doesnt show any SSID scan results. HOT 5
- "no protocol" error HOT 2
- Possible dependency Error HOT 1
- Where to put #define when using classes
- Default all parameters as part of the library
- Compilation error: WiFiMulti.h: No such file or director HOT 1
- Frequent run time error "Connecting MultiWifi..." HOT 1
- Query: some dependencies (eg ESP_DoubleResetDetector) have been archived- safe to keep using?
- how to close the AP after successfully connecting to the configured WiFi? HOT 1
- is there a way to run it "non blocking" ? HOT 1
- FS.h isn't found HOT 1
- Platformio Build Error - no matching function for call to 'LITTLEFSImpl::open HOT 3
- SPIFFS failed!. Please use LittleFS or EEPROM. Stay forever HOT 6
- Device reboot when webServer.begin(); is called HOT 2
- no matching function for call to 'LITTLEFSImpl::open(const char*&, const char [2])' HOT 1
- webServer.addHandler(&events) crashes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espasync_wifimanager.