Skip to content

Commit

Permalink
add workaround for #1543
Browse files Browse the repository at this point in the history
@EtoTen thanks, slight change, Might have to add ipv6 detection instead and handle it that way
  • Loading branch information
tablatronix committed Sep 18, 2023
1 parent 465b44d commit 5a8e869
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions WiFiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,16 @@ boolean WiFiManager::captivePortal() {
if(!_enableCaptivePortal) return false; // skip redirections, @todo maybe allow redirection even when no cp ? might be useful

String serverLoc = toStringIp(server->client().localIP());

// fallback for ipv6 bug
if(serverloc = 0.0.0.0){

This comment has been minimized.

Copy link
@ayavilevich

ayavilevich Sep 20, 2023

Not valid.

This comment has been minimized.

Copy link
@EtoTen

EtoTen Sep 20, 2023

What do you mean?

This comment has been minimized.

Copy link
@ayavilevich

ayavilevich Sep 20, 2023

AFAIK 0.0.0.0 is not a valid literal in c++ .
I guess it was meant to be a string.
Also is this supposed to be = or == or strcmp?

This comment has been minimized.

Copy link
@tablatronix

tablatronix Sep 20, 2023

Author Collaborator

Not valid.

I think I meant to cast it to ipaddr

if ((WiFi.status()) != WL_CONNECTED)
serverLoc = toStringIp(WiFi.softAPIP());
else
serverLoc = toStringIp(WiFi.localIP());
}
}

if(_httpPort != 80) serverLoc += ":" + (String)_httpPort; // add port if not default
bool doredirect = serverLoc != server->hostHeader(); // redirect if hostheader not server ip, prevent redirect loops

Expand Down
3 changes: 3 additions & 0 deletions WiFiManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ class WiFiManager
// but not limited to, we could run continuous background scans on various page hits, or xhr hits
// which would be better coupled with asyncscan
// atm preload is only done on root hit and startcp
//
// preload scanning causes AP to delay showing for users, but also caches and lets the cp load faster once its open
// my scan takes 7-10 seconds
boolean _preloadwifiscan = true; // preload wifiscan if true
unsigned int _scancachetime = 30000; // ms cache time for preload scans
boolean _asyncScan = true; // perform wifi network scan async
Expand Down

0 comments on commit 5a8e869

Please sign in to comment.