Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit 727c89c

Browse files
Merge pull request #63 from azat-ch/proxy-fix-for-GCS
Do not add default port for requests via proxy (fixes GCS via proxy tunnel usage)
2 parents 0e32cb4 + 415a7ea commit 727c89c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Net/src/HTTPClientSession.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,13 @@ std::string HTTPClientSession::proxyRequestPrefix() const
429429
{
430430
std::string result("http://");
431431
result.append(_host);
432-
result.append(":");
433-
NumberFormatter::append(result, _port);
432+
/// Do not append default by default, since this may break some servers.
433+
/// One example of such server is GCS (Google Cloud Storage).
434+
if (_port != HTTPSession::HTTP_PORT)
435+
{
436+
result.append(":");
437+
NumberFormatter::append(result, _port);
438+
}
434439
return result;
435440
}
436441

NetSSL_OpenSSL/src/HTTPSClientSession.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,13 @@ std::string HTTPSClientSession::proxyRequestPrefix() const
138138
{
139139
std::string result("https://");
140140
result.append(getHost());
141-
result.append(":");
142-
NumberFormatter::append(result, getPort());
141+
/// Do not append default by default, since this may break some servers.
142+
/// One example of such server is GCS (Google Cloud Storage).
143+
if (getPort() != HTTPS_PORT)
144+
{
145+
result.append(":");
146+
NumberFormatter::append(result, getPort());
147+
}
143148
return result;
144149
}
145150

0 commit comments

Comments
 (0)