From 74bd4f92004db3c5bdea676c625fda7dffe1533c Mon Sep 17 00:00:00 2001 From: b-pas Date: Sat, 7 May 2016 10:56:24 -0400 Subject: [PATCH] include non-standard ports in Host: header --- libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp index 2733e12e1..488607166 100644 --- a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp +++ b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp @@ -844,8 +844,13 @@ bool HTTPClient::sendHeader(const char * type) header += "1"; } - header += String(F("\r\nHost: ")) + _host + - F("\r\nUser-Agent: ") + _userAgent + + header += String(F("\r\nHost: ")) + _host; + if (_port != 80 && _port != 443) + { + header += ':'; + header += String(_port); + } + header += String(F("\r\nUser-Agent: ")) + _userAgent + F("\r\nConnection: "); if(_reuse) {