Only remove scheme when there's a TLS request ("https")

If condition, for not removing the scheme when proxied connection isn't a TLS request ("http://...").
This commit is contained in:
Rayner De Los Santos F 2017-03-03 08:47:13 -04:00 • committed by GitHub
commit d5d975ceef

View file

@ -719,9 +719,9 @@ proc generateHeaders(requestUrl: Uri, httpMethod: string,
if requestUrl.query.len > 0: if requestUrl.query.len > 0:
result.add("?" & requestUrl.query) result.add("?" & requestUrl.query)
else: else:
# Remove the 'http://' from the URL for CONNECT requests. # Remove the 'http://' from the URL for CONNECT requests for TLS connections.
var modifiedUrl = requestUrl var modifiedUrl = requestUrl
modifiedUrl.scheme = "" if requestUrl.scheme == "https": modifiedUrl.scheme = ""
result.add($modifiedUrl) result.add($modifiedUrl)
# HTTP/1.1\c\l # HTTP/1.1\c\l