ESP8266 Developer Zone The Official ESP8266 Forum 2016-06-28T10:26:22+08:00 https://bbs.espressif.com:443/feed.php?f=66&t=2271 2016-06-28T10:26:22+08:00 2016-06-28T10:26:22+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2271&p=7521#p7521 <![CDATA[Re: OTA HEAD request has 4 extra bytes of NULL(\0) data payload (BUG)]]>
Espressif_Faye wrote:
Hi,

Sorry that we can not reproduce your problem.

Please provide your test code, we will help debug it.

Thanks for your interest in ESP8266 !


Hi, Thanks. I have attached the code shared in dropbox:
https://dl.dropboxusercontent.com/u/37823220/ota.7z

Thanks.

Statistics: Posted by zymxjtu — Tue Jun 28, 2016 10:26 am


]]>
2016-06-20T15:20:37+08:00 2016-06-20T15:20:37+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2271&p=7413#p7413 <![CDATA[Re: OTA HEAD request has 4 extra bytes of NULL(\0) data payload (BUG)]]>
Sorry that we can not reproduce your problem.

Please provide your test code, we will help debug it.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Mon Jun 20, 2016 3:20 pm


]]>
2016-06-17T21:33:50+08:00 2016-06-17T21:33:50+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2271&p=7393#p7393 <![CDATA[Re: OTA HEAD request has 4 extra bytes of NULL(\0) data payload (BUG)]]>
Espressif_Faye wrote:
Hi,

The OTA HEAD is set by the application, not SDK, you need to check your application source code, for example, the "server->url" below

Code:

os_sprintf(server->url, "GET /%s HTTP/1.0\r\nHost: "IPSTR":%d\r\n"pheadbuffer"",
               user_bin, IP2STR(server->ip),
               8080);

if (system_upgrade_start(server) == false) {
        ESP_DBG("upgrade is already started\n");
    }



Hi, Thanks for the reply.

I'm quite sure(if not 100%) I did things correctly. I didn't attach '\0'(NULL) behind. I believe it is inside the espressif SDK OTA, where it construct the "HEAD" message out of the "GET" server->url provided by user. (Note that user does not even provide the "HEAD"message. the SDK somehow takes the server->url user provided, and construct the HEAD message. Check the example you provided, os_sprintf with "GET" not "HEAD"). Can please check the implementation of OTA in the SDK and find out where those 4 bytes NULL attached? I strongly believe there is bug in the OTA of the SDK. Thanks.

Statistics: Posted by zymxjtu — Fri Jun 17, 2016 9:33 pm


]]>
2016-06-13T17:59:35+08:00 2016-06-13T17:59:35+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2271&p=7294#p7294 <![CDATA[Re: OTA HEAD request has 4 extra bytes of NULL(\0) data payload (BUG)]]>
The OTA HEAD is set by the application, not SDK, you need to check your application source code, for example, the "server->url" below

Code:

os_sprintf(server->url, "GET /%s HTTP/1.0\r\nHost: "IPSTR":%d\r\n"pheadbuffer"",
               user_bin, IP2STR(server->ip),
               8080);

if (system_upgrade_start(server) == false) {
        ESP_DBG("upgrade is already started\n");
    }

Statistics: Posted by ESP_Faye — Mon Jun 13, 2016 5:59 pm


]]>
2016-06-12T12:35:33+08:00 2016-06-12T12:35:33+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2271&p=7282#p7282 <![CDATA[【Ongoing】OTA HEAD request has 4 extra bytes of NULL(\0) data payload (BUG)]]>
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.

Image
Image

Statistics: Posted by zymxjtu — Sun Jun 12, 2016 12:35 pm


]]>