Skip to content

Commit e3c79de

Browse files
authored
httpClient: prevent empty user-agent in header (#8411)
1 parent e5a214e commit e3c79de

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -929,8 +929,10 @@ bool HTTPClient::sendHeader(const char * type)
929929
header += ':';
930930
header += String(_port);
931931
}
932-
header += F("\r\nUser-Agent: ");
933-
header += _userAgent;
932+
if (_userAgent.length()) {
933+
header += F("\r\nUser-Agent: ");
934+
header += _userAgent;
935+
}
934936

935937
if (!_useHTTP10) {
936938
header += F("\r\nAccept-Encoding: identity;q=1,chunked;q=0.1,*;q=0");

0 commit comments

Comments
 (0)