ESP8266 library: 2 requests received instead of 1 I have a strange issue with my sketch using WiFiEsp.h library from https://github.com/bportaluri/WiFiEsp

When i send 1 request to my ESP8266 from my browser as http://192.168.0.25
, it seems that my ESP8266 receives 2 requests and run 2 times. See the sketch here and Serial Termninal:

void loop()
{
  // listen for incoming clients
  WiFiEspClient client = server.available();
  if (client) {
    Serial.println("New client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected())
    {
      if (client.available())
      {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' &amp;&amp; currentLineIsBlank) {
          Serial.println("Sending response");

          // send a standard http response header
          // use \r\n instead of many println statements to speedup data send
          client.print(
            "HTTP/1.1 200 OK\r\n"
            "Content-Type: text/html\r\n"
            "Connection: close\r\n"  // the connection will be closed after completion of the response
            "\r\n");
          client.print("&lt;!DOCTYPE HTML&gt;\r\n");
          client.print("&lt;html&gt;\r\n");
          client.print("Hello World!\r\n");
          client.print("&lt;/html&gt;\r\n");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(10);

    // close the connection:
    client.stop();
    Serial.println("Client disconnected");
  }
}


Serial temrinal:

[WiFiEsp] Initializing ESP module
[WiFiEsp] Initilization successful - 2.0.0
Attempting to connect to WPA SSID: Numericable-6010
[WiFiEsp] Connected to Numericable-6010
You're connected to the network
SSID: Numericable-6010
IP Address: 192.168.0.25

To see this page in action, open a browser to http://192.168.0.25

[WiFiEsp] Server started on port 80
[WiFiEsp] New client 0
New client
GET / HTTP/1.1
Host: 192.168.0.25
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://192.168.0.25/
Accept-Encoding: gzip, deflate
Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7

Sending response
[WiFiEsp] Disconnecting  0
Client disconnected
[WiFiEsp] New client 1
New client
GET /favicon.ico HTTP/1.1
Host: 192.168.0.25
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Accept: image/webp,image/apng,image/*,*/*;q=0.8
Referer: http://192.168.0.25/
Accept-Encoding: gzip, deflate
Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7

Sending response
[WiFiEsp] Disconnecting  1
Client disconnected


Please, could you explain why 2 clients connected ? How can i disconnect just after the first one ?
Browsers automaticaly request /favicon.ico for sites. Add this to &lt;head&gt; section of your HTML to eliminate the 'favicon' request: 

&lt;link rel="icon" href="data:;base64,iVBORw0KGgo="&gt;

client.println("HTTP/1.1 200 OK\r\n" "Content-Type: text/html"); 
client.println("Connection: close"); 
client.println(); 
client.println("&lt;!DOCTYPE HTML&gt;"); 
client.println("&lt;html&gt;&lt;head&gt;"); 
client.println("&lt;link rel='icon' href='data:;base64,iVBORw0KGgo='&gt;"); 
client.println("&lt;/head&gt;&lt;body&gt;"); 
client.println("Hello World!"); 
client.println("&lt;/body&gt;&lt;/html&gt;");


based on this SO answer, instead of pointing to a server, the icon is encoded in the href parameter as base64 string