summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorNick Wilburn <senior.crepe@gmail.com>2021-12-14 06:22:10 -0600
committerGitHub <noreply@github.com>2021-12-14 12:22:10 +0000
commitc55930f2e644fe04526eb4878e7e106229812fe4 (patch)
tree06abafef27cfe64e38fe840ae5d458bd90bdf423 /tests/stdlib
parent78b86b79425f37683ce522dbdd567f52ea26aa35 (diff)
downloadNim-c55930f2e644fe04526eb4878e7e106229812fe4.tar.gz
fix: fixes bug in CVerifyPeerUseEnvVars (#19247)
Previously CVerifyPeerUseEnvVars was not being passed into
scanSslCertificates, which meant that we weren't scanning
additional certificate locations given via the SSL_CERT_FILE and
SSL_CERT_DIR environment variables
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/thttpclient_ssl.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/stdlib/thttpclient_ssl.nim b/tests/stdlib/thttpclient_ssl.nim
index 1c531eae9..3acdacfe3 100644
--- a/tests/stdlib/thttpclient_ssl.nim
+++ b/tests/stdlib/thttpclient_ssl.nim
@@ -129,3 +129,19 @@ when not defined(windows):
           msg.contains("certificate verify failed")):
           echo "CVerifyPeer exception: " & msg
           check(false)
+
+    test "HttpClient with CVerifyPeerUseEnvVars":
+      const port = 12346.Port
+      let t = spawn runServer(port)
+      sleep(100)
+
+      putEnv("SSL_CERT_FILE", getCurrentDir() / certFile)
+      var client = newHttpClient(sslContext=newContext(verifyMode=CVerifyPeerUseEnvVars))
+      try:
+        log "client: connect"
+        discard client.getContent("https://127.0.0.1:12346")
+      except:
+        let msg = getCurrentExceptionMsg()
+        log "client: exception: " & msg
+        log "getContent should not have raised an exception"
+        fail()