<jupyter_start><jupyter_text>TLS Examples<jupyter_code>h <- curl::new_handle()

# Bad
# handle_setopt(h, ssl_verifypeer = 0);

# Good
cat(c("CURL_CA_BUNDLE =", Sys.getenv("CURL_CA_BUNDLE"), "\n"));
curl::handle_setopt(h, cainfo = Sys.getenv("CURL_CA_BUNDLE"));

resp <- curl::curl_fetch_memory("https://git.nrtn.dev", h)
cat(rawToChar(resp$content))
# Bad
# httr::set_config( httr::config( ssl_verifypeer = 0L ) )

# Good
httr::set_config(httr::config(cainfo = Sys.getenv("CURL_CA_BUNDLE")))

httr::GET("https://git.nrtn.dev")
# Env
res <- system("env", intern=TRUE)
cat(res, sep = "\n")
# SSL
res <- system("openssl s_client -connect git.nrtn.dev:443", intern=TRUE)
cat(res, sep = "\n")
# SSL Dir
res <- system("openssl version -d", intern=TRUE)
cat(res, sep = "\n")

res <- system("ls -la /srv/conda/envs/notebook/ssl", intern=TRUE)
cat(res, sep = "\n")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.207909604519774, 'fraction_numerical': 0.005649717514124294, 'mean_word_length': 6.031746031746032, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '384359', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 397, 'n_tokens_neox': 379, 'n_words': 62, 'path': 'tls-examples.ipynb', 'repo_name': 'noroutine/r-tls', 'size': '885'}