Skip to contents

Sends a ranged GET for the first byte, so that the answer carries the resource's real headers without the resource, and reports what came back. A HEAD is not used because some servers answer it differently from a GET; a one-byte range is answered like the full request.

Usage

probe(url, clearance = NULL)

Arguments

url

The URL.

clearance

A clearance from clearance(), to probe as the browser that earned it; NULL probes as a plain client.

Value

A list: reachable (was any response had), status (the HTTP status, NA when unreachable), challenged (see is_challenge()), blocked (see is_block()), type (the content-type, lower case), size (the resource's length in bytes, taken from content-range when the request was answered with a range, else content-length; NA when unknown) and headers (the parsed list). A browser is called for when challenged or blocked is TRUE.

Examples

if (FALSE) { # \dontrun{
url <- paste0("https://www12.statcan.gc.ca/census-recensement/2021/",
              "geo/sip-pis/rnf-frr/files-fichiers/lrnf000r21a_e.zip")
probe(url)
} # }