Aliases: parse_headers parse_headers_list
Keywords:
### ** Examples req <- curl_fetch_memory("https://hb.cran.dev/redirect/3") parse_headers(req$headers)
[1] "HTTP/2 200 " [2] "date: Mon, 11 Aug 2025 15:54:00 GMT" [3] "content-type: application/json" [4] "server: cloudflare" [5] "nel: {\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}" [6] "access-control-allow-origin: *" [7] "access-control-allow-credentials: true" [8] "x-powered-by: Flask" [9] "x-processed-time: 0" [10] "cf-cache-status: DYNAMIC" [11] "report-to: {\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=u48wBK55dPKvDKEy8FFkCbT5wWygCbkZg9%2FVASWhSQhZ%2BbwtQ1FcDpuasGWh8h%2BVKF%2F7hGt2SIphearFWjT120SVcYEk%2BcA%3D\"}]}" [12] "content-encoding: zstd" [13] "cf-ray: 96d8e8b9f95b5089-AKL" [14] "alt-svc: h3=\":443\"; ma=86400"
parse_headers(req$headers, multiple = TRUE)
[[1]] [1] "HTTP/2 302 " [2] "date: Mon, 11 Aug 2025 15:54:00 GMT" [3] "content-type: text/html; charset=utf-8" [4] "server: cloudflare" [5] "nel: {\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}" [6] "location: /relative-redirect/2" [7] "access-control-allow-origin: *" [8] "access-control-allow-credentials: true" [9] "x-powered-by: Flask" [10] "x-processed-time: 0" [11] "cf-cache-status: DYNAMIC" [12] "report-to: {\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=LIx7qlHG8wT3hLKL37uqNbAVt2cgJlhAZC3bypW5ye2Bc40G5XOpWQ%2BQznZNgh72K2SsTLdO%2FCu%2FQ2mE%2B12fLlUTXsC2kW0%3D\"}]}" [13] "cf-ray: 96d8e8b3cbf55089-AKL" [14] "alt-svc: h3=\":443\"; ma=86400" [[2]] [1] "HTTP/2 302 " [2] "date: Mon, 11 Aug 2025 15:54:00 GMT" [3] "content-type: text/html; charset=utf-8" [4] "server: cloudflare" [5] "nel: {\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}" [6] "location: /relative-redirect/1" [7] "access-control-allow-origin: *" [8] "access-control-allow-credentials: true" [9] "x-powered-by: Flask" [10] "x-processed-time: 0" [11] "cf-cache-status: DYNAMIC" [12] "report-to: {\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=6fAyYsiH0uyYOq9c0Ne4yGEqqB1SAxfKHNe3%2FP0%2BNG8rbThKWi6jw4aapPw5OSyub3fIqNwHnio9bbe1rXsddAYrQRvePB0%3D\"}]}" [13] "cf-ray: 96d8e8b61df05089-AKL" [14] "alt-svc: h3=\":443\"; ma=86400" [[3]] [1] "HTTP/2 302 " [2] "date: Mon, 11 Aug 2025 15:54:00 GMT" [3] "content-type: text/html; charset=utf-8" [4] "server: cloudflare" [5] "nel: {\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}" [6] "location: /get" [7] "access-control-allow-origin: *" [8] "access-control-allow-credentials: true" [9] "x-powered-by: Flask" [10] "x-processed-time: 0" [11] "cf-cache-status: DYNAMIC" [12] "report-to: {\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=W9VK0j0w%2FdJBvMIaP80%2FQaCCsL3GUbvHmSqj5S5oOIblxpi%2BLfu7flzfnpumjXdIPKoLjRHw51FqCn57Jtdd%2FoT31RgyDp4%3D\"}]}" [13] "cf-ray: 96d8e8b80fa55089-AKL" [14] "alt-svc: h3=\":443\"; ma=86400" [[4]] [1] "HTTP/2 200 " [2] "date: Mon, 11 Aug 2025 15:54:00 GMT" [3] "content-type: application/json" [4] "server: cloudflare" [5] "nel: {\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}" [6] "access-control-allow-origin: *" [7] "access-control-allow-credentials: true" [8] "x-powered-by: Flask" [9] "x-processed-time: 0" [10] "cf-cache-status: DYNAMIC" [11] "report-to: {\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=u48wBK55dPKvDKEy8FFkCbT5wWygCbkZg9%2FVASWhSQhZ%2BbwtQ1FcDpuasGWh8h%2BVKF%2F7hGt2SIphearFWjT120SVcYEk%2BcA%3D\"}]}" [12] "content-encoding: zstd" [13] "cf-ray: 96d8e8b9f95b5089-AKL" [14] "alt-svc: h3=\":443\"; ma=86400"
# Parse into named list parse_headers_list(req$headers)
$date [1] "Mon, 11 Aug 2025 15:54:00 GMT" $`content-type` [1] "application/json" $server [1] "cloudflare" $nel [1] "{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}" $`access-control-allow-origin` [1] "*" $`access-control-allow-credentials` [1] "true" $`x-powered-by` [1] "Flask" $`x-processed-time` [1] "0" $`cf-cache-status` [1] "DYNAMIC" $`report-to` [1] "{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=u48wBK55dPKvDKEy8FFkCbT5wWygCbkZg9%2FVASWhSQhZ%2BbwtQ1FcDpuasGWh8h%2BVKF%2F7hGt2SIphearFWjT120SVcYEk%2BcA%3D\"}]}" $`content-encoding` [1] "zstd" $`cf-ray` [1] "96d8e8b9f95b5089-AKL" $`alt-svc` [1] "h3=\":443\"; ma=86400"