Skip to content

Commit 9ab5ec5

Browse files
DNSServer: Handle examplewww.com correctly
Just replacing 'www.' with the empty string when we assign the domainname will remove all occurrences of 'www.', not just those at the start of the string. Change this to a startsWith check so that only "www." at the beginning of the string is removed.
1 parent 2f0f49d commit 9ab5ec5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libraries/DNSServer/src/DNSServer.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ void DNSServer::stop()
4646
void DNSServer::downcaseAndRemoveWwwPrefix(String &domainName)
4747
{
4848
domainName.toLowerCase();
49-
domainName.replace("www.", "");
49+
if (domainName.startsWith("www."))
50+
domainName.remove(0, 4);
5051
}
5152

5253
void DNSServer::processNextRequest()

0 commit comments

Comments
 (0)