-
Notifications
You must be signed in to change notification settings - Fork 13.3k
HttpUpdate Example - HTTP_UPDATE_FAILD Error (-104): Wrong HTTP code #2022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Which version of ESP8266 Arduino core are you using? |
The Adafruit Huzzah Board. The sketch has the libraries not showing; These are the ones I use. I completely replaced the setup section of the example. To the one shown above. |
I mean, which version of software did you install? 2.0.0, 2.1.0, 2.2.0, 2.3.0-rc1, etc? |
Oh yeah sorry, its 2.2.0 . |
Could you please try running the same with 2.3.0-rc1? There were some issues with HTTPClient library which were fixed in 2.3.0-rc1. Edit: this version is available at |
Installed the 2.3.0-rc1 , the code wont compile now . says Board huzzah (platform esp8266, package esp8266) is unknown Error compiling for board Adafruit HUZZAH ESP8266. |
I did not remove the 2.2.0 before installing 2.3.0-rc1 . I manually deleted the 2.2.0 folder and installed the 2.3.0-rc1 like you said. The code compiles fine now. The new HTTP error it shows now is : |
Which is probably the correct behaviour now, because you are loading HTTPS URL without specifying certificate fingerprint. Could you try the same, replacing |
Tried the http version, the error is back to |
Your server sends HTTP code 301, "Moved permanently". ESP8266HTTPUpdate library doesn't support HTTP redirects at this point. It expects an URL which points directly to the binary.
|
Thanks for that! Do you have any suggestions on servers I could use to get a direct link to the bin file? |
Well using the URL from |
Could you please post the sketch you've used ? I have tried both the http and https URLS, and it still does not seem to be working for me. HTTPS : gives the connection refused error I even tried the default httpServer example, changing only the ssid password and the url . The results are the same. |
Sketch was: #include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();
WiFi.begin("testbox1", "testbox123");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
}
Serial.println("Connected, updating");
delay(1000);
t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin", "", "21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58");
}
void loop() {
} Don't forget to power cycle the ESP after uploading this sketch, otherwise it will fail to update. Output (with some debugging enabled from Tools menu):
The |
Thanks for the help @igrr ! Edit: After the OTA , the esp seems to require a manual reset every single time. This is what I received on my serial monitor using your sketch. Connected, updating ets Jan 8 2013,rst cause:2, boot mode:(1,6) ets Jan 8 2013,rst cause:4, boot mode:(1,6) wdt reset The system hangs after printing this out . A manual reset after this seems to run the new sketch . The serial monitor output is different to what you have posted for the same sketch. Like , some lines are missing and the reset cause seems to be different. |
ESP requires manual reset after UART upload, but not after OTA upload. Your boot mode ( |
Not Resetting after UART upload was the reason. OTA works perfectly now. Cheers! |
Can anyone help me with this issue... I ahve hosted the bin file on Microsft IIS server at this location http://192.168.0.5:912/blinkredLedFast.bin. If I try to access this link from browser I do get the download option. However if I use it in the code I get error as HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused I tried replacing the below code t_httpUpdate_return ret = ESPhttpUpdate.update("http://192.168.0.5:912/blinkredLedFast.bin","80"); with and bin files get downloaded successfully. in to my Adafruit huzzah feather. |
There is a section called "Advanced updater" in https://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html Also in .arduino15/packages/esp8266/hardware/esp8266/2.3.0/doc/ota_updates/readme.md, line 342 It seems I can create a php script, then when hit this script, firmware will be downloaded, no need to hit the direct bin file in server. Am I correct? Because I have a URL in laravel 5, which allows the firmware to be download dynamically. Currently, I am not able to make it working. In your comment above, esp update only allows direct hit to the bin file. Are you able to clarify? |
Sorry, i'm not familiar with php and laravel. Currently HTTP response has to contain the actual binary, not a redirect to another URL. I.e. response code has to be 20x and with binary file in the body of response. |
Hi, This the url: https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware
3.The header I am using
|
Since you're using HTTPS, you need to provide HTTPS certificate fingerprint as third argument to edit: ESPhttpUpdate.update("https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware", "", "80 C7 58 94 C8 D7 E0 D0 96 4D E8 E3 30 35 03 CF 4A 22 32 C2"); |
Can you please fix this issue? Thank you. |
Hi maybe someone can help me. I have had some success with OTA but not with this sketch [httpUpdate] Header read fin. Exception (0): ctx: sys
|
Hi, I got "HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused" |
@Cristianistrate doesn't the port need to be "80" rather than 80? |
Tried "80". same error. |
I guess the error is because you check for "HTTP_X_ESP8266_SKETCH_MD5" header. |
It's supplied if you're using the git version.
…On Fri, Apr 28, 2017 at 11:16 PM, tk ***@***.***> wrote:
I guess the error is because you check for "HTTP_X_ESP8266_SKETCH_MD5"
header.
Although it's written in all the examples around the net, it's never sent
by ESP8266. Maybe it's bug, maybe I'm doing it wrong, but
HTTP_X_ESP8266_SKETCH_MD5 header is missing on my ESPs.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2022 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAN_A1d9fqfm_xTjMQaEkuaEtZRgGI9xks5r0cqdgaJpZM4Id0EP>
.
|
I can get OTA updates working using http, but not using https code is: #include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #define USE_SERIAL Serial ESP8266WiFiMulti WiFiMulti; //use this when using ESP8266WiFiMulti.h const char* ssid = "...my ssid.."; void setup() { //setup serial port
//connect to wifi
//establish a connection to remote web server
} void loop() { ================================================= [SETUP] WAIT 4... connected with 2GHz, channel 6 Waiting for wifi WiFi connected. IP address:192.168.1.147 Exception (29): ctx: cont
ets Jan 8 2013,rst cause:2, boot mode:(1,7) ets Jan 8 2013,rst cause:4, boot mode:(1,7) wdt reset =====if I power cycle then I get the following: connected with 2GHz, channel 6 Waiting for wifi WiFi connected. IP address:192.168.1.147 Exception (29): ctx: cont
ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x4010f000, len 1384, room 16 [SETUP] WAIT 4... connected with 2GHz, channel 6 Waiting for wifi WiFi connected. IP address:192.168.1.147 Exception (29): ctx: cont
ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x4010f000, len 1384, room 16 [SETUP] WAIT 4... connected with 2GHz, channel 6 ======running flash config example gives the following output: Flash ide size: 4194304 ============= Fatal exception 29(StoreProhibitedCause): Anybody know what the fix is? |
I have tried to implement the HttpUpdate Example albeit it with a few changes. Here is my sketch:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
*
*/
include "Arduino.h"
include "ESP8266WiFi.h"
include "ESP8266HTTPClient.h"
include "ESP8266httpUpdate.h"
const char* ssid = "ssid";
const char* password = "password";
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
delay(100);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
delay(500);
}
void loop()
{
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I get the wrong http code error as mentioned in the title, I tried looking online but could not find anything useful. I was wondering if anyone can help me figure out how to resolve it.
Thanks a lot in advance fellas! Appreciate the help.
The text was updated successfully, but these errors were encountered: