Skip to content

Commit

Permalink
Merge pull request rg1220#1 from johnmckerrell/master
Browse files Browse the repository at this point in the history
Fixing bug in HttpClient Host Header when the port isn't the default
  • Loading branch information
amcewen committed Sep 28, 2012
2 parents ea1618b + 8bb4f74 commit fc72d82
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion HttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,14 @@ int HttpClient::sendInitialHeaders(const char* aServerName, IPAddress aServerIP,
// The host header, if required
if (aServerName)
{
sendHeader("Host", aServerName);
iClient->print("Host: ");
iClient->print(aServerName);
if (aPort != kHttpPort)
{
iClient->print(":");
iClient->print(aPort);
}
iClient->println();
}
// And user-agent string
iClient->print("User-Agent: ");
Expand Down

0 comments on commit fc72d82

Please sign in to comment.