{"action":"created","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/4899","repository_url":"https://api.github.com/repos/esp8266/Arduino","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/4899/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/4899/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/4899/events","html_url":"https://github.com/esp8266/Arduino/issues/4899","id":339175232,"node_id":"MDU6SXNzdWUzMzkxNzUyMzI=","number":4899,"title":"HTTPUpdate Error: \"connection refused\" with BearSSL","user":{"login":"antiFetzen","id":40720254,"node_id":"MDQ6VXNlcjQwNzIwMjU0","avatar_url":"https://avatars2.githubusercontent.com/u/40720254?v=4","gravatar_id":"","url":"https://api.github.com/users/antiFetzen","html_url":"https://github.com/antiFetzen","followers_url":"https://api.github.com/users/antiFetzen/followers","following_url":"https://api.github.com/users/antiFetzen/following{/other_user}","gists_url":"https://api.github.com/users/antiFetzen/gists{/gist_id}","starred_url":"https://api.github.com/users/antiFetzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antiFetzen/subscriptions","organizations_url":"https://api.github.com/users/antiFetzen/orgs","repos_url":"https://api.github.com/users/antiFetzen/repos","events_url":"https://api.github.com/users/antiFetzen/events{/privacy}","received_events_url":"https://api.github.com/users/antiFetzen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-07T21:12:09Z","updated_at":"2018-08-30T09:28:39Z","closed_at":null,"author_association":"NONE","body":"### Basic Infos\r\n\r\n- [X] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).\r\n- [X] I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) and the issue is not addressed there.\r\n- [X] I have tested that the issue is present in current master branch (aka latest git).\r\n- [X] I have searched the issue tracker for a similar issue.\r\n- [X] If there is a stack dump, I have decoded it.\r\n- [X] I have filled out all fields below.\r\n\r\n#### Platform\r\n\r\n- Hardware:\t\t\t\tESP8266\r\n- Core Version:\t\t\te486887\r\n- Development Env:\t\tPlatformio\r\n- Operating System:\t\tWindows 10\r\n\r\n### Settings in IDE\r\n\r\n- Module:  \t\t\tWemos D1 mini\r\n- Flash Mode:\t\t\t[qio|dio|other]\r\n- Flash Size: \t\t\t4MB\r\n- lwip Variant:  \t\tv1.4\r\n- Reset Method:\t\tck\r\n- Flash Frequency:\t\t40Mhz\r\n- CPU Frequency:\t\t160Mhz\r\n- Upload Using:\t\tSERIAL\r\n- Upload Speed:   \t\t115200\r\n\r\n\r\n### Problem Description\r\n\r\nHere's my next problem.\r\n\r\nI want to add HTTPUpdate to my HTTPS server and encrypt it with BearSSL.\r\n\r\nupdate via HTTP worked\r\n```cpp\r\nt_httpUpdate_return  ret = ESPhttpUpdate.update(\"http://buildsrv1/firmware.bin\");\r\n```\r\nI can access the firmware via browser via HTTP and HTTPS.\r\n\r\n### [MCVE](https://stackoverflow.com/help/mcve) Sketch\r\n\r\n```cpp\r\n\r\n#include <ESP8266WiFi.h>\r\n#include <WiFiClient.h>\r\n#include <ESP8266WebServerSecure.h>\r\n#include <ESP8266mDNS.h>\r\n\r\n#include <ESP8266httpUpdate.h>\r\n\r\nconst char* ssid = \"wifi\";\r\nconst char* password = \"1234\";\r\n\r\nBearSSL::ESP8266WebServerSecure server(443);\r\nstatic const char serverCert[] PROGMEM = R\"EOF(...)EOF\";\r\nstatic const char serverKey[] PROGMEM =  R\"EOF(...)EOF\";\r\n\r\n\r\nvoid httpUpdate() {\r\n\r\n  const char* host = \"buildsrv1\";\r\n  const uint16_t port = 443;\r\n  const char* path = \"/firmware.bin\";\r\n  const uint8_t fp[20] = {0xe4, 0x8a, 0x7d, 0xf1, 0x5d, 0x68, 0x53, 0xf7, 0x30, 0x53, 0x1e, 0xad, 0x91, 0xcd, 0x5c, 0x90, 0x2e, 0xc4, 0x66, 0xda};\r\n\r\n  Serial.println(\"start HTTP update\");\r\n  t_httpUpdate_return  ret = ESPhttpUpdate.update(host, port, path, \"\", fp);\r\n\r\n  switch (ret) {\r\n    case HTTP_UPDATE_FAILED:\r\n      Serial.printf(\"HTTP_UPDATE_FAILD Error (%d): %s\", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());\r\n      break;\r\n\r\n    case HTTP_UPDATE_NO_UPDATES:\r\n      Serial.println(\"HTTP_UPDATE_NO_UPDATES\");\r\n      break;\r\n\r\n    case HTTP_UPDATE_OK:\r\n      Serial.println(\"HTTP_UPDATE_OK\");\r\n      break;\r\n  }\r\n\r\n}\r\n\r\nvoid setup() { \r\n  WiFi.begin(ssid, password);\r\n  ....\r\n\r\n  server.on(\"/update\", [](){\r\n    httpUpdate();\r\n    server.send(200, \"text/plain\", \"updateFirmware\");\r\n  });\r\n}\r\n\r\nvoid loop() {\r\n  server.handleClient();\r\n}\r\n\r\n```\r\n\r\n### Debug Messages\r\n\r\n```\r\nRequest: /update\r\n Arguments:\r\nstart HTTP update\r\n[HTTP-Client][begin] host: buildsrv1 port: 443 url: /firmware.bin BearSSL-httpsFingerprint: e4 8a 7d f1 5d 68 53 f7 30 53 1e ad 91 cd 5c 90 2e c4 66 da\r\n[hostByName] request IP for: buildsrv1\r\n[hostByName] Host: buildsrv1 IP: 192.168.176.110\r\n:ref 1\r\n[HTTP-Client] failed connect to buildsrv1:443\r\n[HTTP-Client][returnError] error(-1): connection refused\r\n[httpUpdate] HTTP error: connection refused\r\n[HTTP-Client][end] tcp is closed\r\n:abort\r\n:ur 1\r\n:del\r\nHTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused:wr 113 113 0\r\n:wrc 113 113 -1\r\n:wr 113 113 0\r\n:wrc 113 113 -1\r\n:wr 113 113 0\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/comments/417253681","html_url":"https://github.com/esp8266/Arduino/issues/4899#issuecomment-417253681","issue_url":"https://api.github.com/repos/esp8266/Arduino/issues/4899","id":417253681,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzI1MzY4MQ==","user":{"login":"Kadah","id":751209,"node_id":"MDQ6VXNlcjc1MTIwOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/751209?v=4","gravatar_id":"","url":"https://api.github.com/users/Kadah","html_url":"https://github.com/Kadah","followers_url":"https://api.github.com/users/Kadah/followers","following_url":"https://api.github.com/users/Kadah/following{/other_user}","gists_url":"https://api.github.com/users/Kadah/gists{/gist_id}","starred_url":"https://api.github.com/users/Kadah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kadah/subscriptions","organizations_url":"https://api.github.com/users/Kadah/orgs","repos_url":"https://api.github.com/users/Kadah/repos","events_url":"https://api.github.com/users/Kadah/events{/privacy}","received_events_url":"https://api.github.com/users/Kadah/received_events","type":"User","site_admin":false},"created_at":"2018-08-30T09:28:39Z","updated_at":"2018-08-30T09:28:39Z","author_association":"NONE","body":"Appears it might be memory related."}}
{"actor":{"display_login":"Kadah"}}