| 1 |
# This tests TLS 1.2 |
| 2 |
test_that("CloudFlare / LetsEncrypt certs", { |
| 3 |
expect_equal(curl_fetch_memory('https://www.opencpu.org')$status_code, 200) |
| 4 |
expect_equal(curl_fetch_memory('https://letsencrypt.org')$status_code, 200) |
| 5 |
|
| 6 |
# Test HTTP -> HTTPS (TLS 1.2) redirection |
| 7 |
expect_equal(curl_fetch_memory('http://curl.se')$status_code, 200) |
| 8 |
}) |
| 9 |
|
| 10 |
test_that("Invalid domain raises an error", { |
| 11 |
ipaddr <- nslookup("www.google.com", ipv4_only = TRUE) |
| 12 |
h <- new_handle(resolve = paste0("fakehostname:443:", ipaddr)) |
| 13 |
expect_error(curl_fetch_memory("https://fakehostname", handle = h), "certificate", class = "curl_error_peer_failed_verification") |
| 14 |
handle_setopt(h, ssl_verifyhost = FALSE, ssl_verifypeer = FALSE) |
| 15 |
expect_is(curl_fetch_memory("https://fakehostname", handle = h)$status, "integer") |
| 16 |
}) |
| 17 |
|
| 18 |
test_that("GC works", { |
| 19 |
gc() |
| 20 |
expect_equal(total_handles(), 0L) |
| 21 |
}) |