When I'm working on the OTA of ESP8266, I found out that the OTA works when I use Apache or Nginx as server, but it does not work with my Node.js server. I took a lot of time to find out why. In the end, I found out that ESP8266 send out extra 4 bytes 0 at the the end of the HEAD request.
According to HTTP 1.1 spec, HEAD request should not have data payload, so Node.js http parser will treat the HEAD request from ESP8266 as malformed request and close the socket. While Apache/Nginx seems will be able to tolerate it.
Are there any reason why this extra 4 bytes 0 are attached? Can espressif please take a look at it and fix this bug in next SDK release?
I'm using NON-OS SDK 1.5.2 by the way. Tested latest SDK 1.5.4 has problem also.
I have tired sending request using curl to the Node.js server which works well, and using wireshark to capture the packet send by curl and ESP8266, after doing compare, found out this 4 extra bytes 0 problem.

