Improve SSL error message in httpclient.
This commit is contained in:
parent
6f0bb6e1f5
commit
fb3e460f6d
1 changed files with 6 additions and 5 deletions
|
|
@ -507,7 +507,7 @@ proc request*(url: string, httpMethod: string, extraHeaders = "",
|
||||||
port = net.Port(443)
|
port = net.Port(443)
|
||||||
else:
|
else:
|
||||||
raise newException(HttpRequestError,
|
raise newException(HttpRequestError,
|
||||||
"SSL support is not available. Cannot connect over SSL.")
|
"SSL support is not available. Cannot connect over SSL. Compile with -d:ssl to enable.")
|
||||||
if r.port != "":
|
if r.port != "":
|
||||||
port = net.Port(r.port.parseInt)
|
port = net.Port(r.port.parseInt)
|
||||||
|
|
||||||
|
|
@ -540,7 +540,8 @@ proc request*(url: string, httpMethod: string, extraHeaders = "",
|
||||||
"so a secure connection could not be established.")
|
"so a secure connection could not be established.")
|
||||||
sslContext.wrapConnectedSocket(s, handshakeAsClient, hostUrl.hostname)
|
sslContext.wrapConnectedSocket(s, handshakeAsClient, hostUrl.hostname)
|
||||||
else:
|
else:
|
||||||
raise newException(HttpRequestError, "SSL support not available. Cannot connect via proxy over SSL")
|
raise newException(HttpRequestError, "SSL support not available. Cannot " &
|
||||||
|
"connect via proxy over SSL. Compile with -d:ssl to enable.")
|
||||||
else:
|
else:
|
||||||
if timeout == -1:
|
if timeout == -1:
|
||||||
s.connect(r.hostname, port)
|
s.connect(r.hostname, port)
|
||||||
|
|
@ -1087,7 +1088,7 @@ proc newConnection(client: HttpClient | AsyncHttpClient,
|
||||||
|
|
||||||
if isSsl and not defined(ssl):
|
if isSsl and not defined(ssl):
|
||||||
raise newException(HttpRequestError,
|
raise newException(HttpRequestError,
|
||||||
"SSL support is not available. Cannot connect over SSL.")
|
"SSL support is not available. Cannot connect over SSL. Compile with -d:ssl to enable.")
|
||||||
|
|
||||||
if client.connected:
|
if client.connected:
|
||||||
client.close()
|
client.close()
|
||||||
|
|
@ -1137,7 +1138,7 @@ proc newConnection(client: HttpClient | AsyncHttpClient,
|
||||||
client.socket, handshakeAsClient, url.hostname)
|
client.socket, handshakeAsClient, url.hostname)
|
||||||
else:
|
else:
|
||||||
raise newException(HttpRequestError,
|
raise newException(HttpRequestError,
|
||||||
"SSL support is not available. Cannot connect over SSL.")
|
"SSL support is not available. Cannot connect over SSL. Compile with -d:ssl to enable.")
|
||||||
|
|
||||||
# May be connected through proxy but remember actual URL being accessed
|
# May be connected through proxy but remember actual URL being accessed
|
||||||
client.currentURL = url
|
client.currentURL = url
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue