Skip to content

Commit 3dcf0b1

Browse files
tests: skip wrong host test for SSL_NO_VERIFY (fix #139) (#140)
Since #114, we only turn off peer verification, not host verification when the `SSL_NO_VERIFY` variables are set. This means that the last set of tests in the "SSL no verify override" testset *should* fail for `wrong.host.badssl.com`. That is not what I was seeing, however — the test was still passing — which I found puzzling but just moved on with my life at the time. It turns out that the test *does* fail if libcurl is build with OpenSSL. Since whether the test passes or not for that host depends on how things are built, this change simply skips the test (by popping the URL from the set of tested URLS for that testset). The tests above that which use the easy hook mechanism are fixed in a different way: for those I made the hook disable both host and peer verification, which should fix the tests for any bad host including when the server sends the wrong host name. (cherry picked from commit e22219f)
1 parent 914bac7 commit 3dcf0b1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/runtests.jl

+7-2
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ include("setup.jl")
383383

384384
@testset "bad TLS" begin
385385
urls = [
386-
"https://wrong.host.badssl.com"
387386
"https://untrusted-root.badssl.com"
387+
"https://wrong.host.badssl.com"
388388
]
389389
@testset "bad TLS is rejected" for url in urls
390390
resp = request(url, throw=false)
@@ -394,7 +394,9 @@ include("setup.jl")
394394
@testset "easy hook work-around" begin
395395
local url
396396
easy_hook = (easy, info) -> begin
397-
Curl.set_ssl_verify(easy, false)
397+
# don't verify anything (this disables SNI also)
398+
Curl.setopt(easy, Curl.CURLOPT_SSL_VERIFYPEER, false)
399+
Curl.setopt(easy, Curl.CURLOPT_SSL_VERIFYHOST, false)
398400
@test info.url == url
399401
end
400402
# downloader-specific easy hook
@@ -417,6 +419,9 @@ include("setup.jl")
417419
Downloads.EASY_HOOK[] = nothing
418420
end
419421
ENV["JULIA_SSL_NO_VERIFY_HOSTS"] = "**.badssl.com"
422+
# wrong host *should* still fail, but may not due
423+
# to libcurl bugs when using non-OpenSSL backends:
424+
pop!(urls) # <= skip wrong host URL entirely here
420425
@testset "SSL no verify override" for url in urls
421426
resp = request(url, throw=false)
422427
@test resp isa Response

0 commit comments

Comments
 (0)