title: How to build HTTP Response with ESP8266 and Arduino
body: <p>I want to toggle some LEDs with my Android device. These LEDs are connected to the digital Pins of my Arduino which is also connected to a ESP8266. Now, my ESP8266 is defined as an AccessPoint and my Tablet can send HTTP requests (e.g. <a href="http://192.168.4.1:80/?pin=11" rel="nofollow">http://192.168.4.1:80/?pin=11</a>).
  I found the code here <a href="http://allaboutee.com/2015/01/20/esp8266-android-application-for-arduino-pin-control/" rel="nofollow">http://allaboutee.com/2015/01/20/esp8266-android-application-for-arduino-pin-control/</a></p>
  
  <p>It works fine but my question is which HTTP header fields should be used? In this code he used some (e.g. Content-Length) but there are so much more possible (Date, Server, Content-Language,...).</p>
  
  <p>Are these fields optional or which of these have to be used to build the right response?</p>
  
  <p>Here is the piece of code I do not understand:</p>
  
  <pre><code>void sendHTTPResponse(int connectionId, String content)
  </code></pre>
  
  <p>{</p>
  
  <pre><code> String httpResponse;
   String httpHeader;
  
   httpHeader = "HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\n"; 
   httpHeader += "Content-Length: ";
   httpHeader += content.length();
   httpHeader += "\r\n";
   httpHeader +="Connection: close\r\n\r\n";
   httpResponse = httpHeader + content + " ";
   sendCIPData(connectionId,httpResponse);
  </code></pre>
  
  <p>}</p>