From 67436307bfaf4d2f944af35316c5f4a9ad6a4779 Mon Sep 17 00:00:00 2001 From: hogliux Date: Thu, 25 Jun 2015 16:14:29 +0100 Subject: [PATCH] Include port number in http request header if it is a non-standard port number (see HTTP spec 14.23) --- modules/juce_core/native/juce_linux_Network.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/juce_core/native/juce_linux_Network.cpp b/modules/juce_core/native/juce_linux_Network.cpp index da0649fbd5..61553bdd9d 100644 --- a/modules/juce_core/native/juce_linux_Network.cpp +++ b/modules/juce_core/native/juce_linux_Network.cpp @@ -343,9 +343,13 @@ private: } static void writeHost (MemoryOutputStream& dest, const bool isPost, - const String& path, const String& host, int /*port*/) + const String& path, const String& host, int port) { dest << (isPost ? "POST " : "GET ") << path << " HTTP/1.0\r\nHost: " << host; + + /* HTTP spec 14.23 says that the port number must be included in the header if it is not 80 */ + if (port != 80) + dest << ':' << port; } static MemoryBlock createRequestHeader (const String& hostName, const int hostPort,