probe: Ask a server what it serves at a URL

View source: R/probe.R

probeR Documentation

Ask a server what it serves at a URL

Description

Sends a GET for the first byte, so that the answer carries the resource's headers without the resource; a HEAD is not used because some servers answer it differently.

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.

Details

It is the one-request way for a calling package to find out whether a host needs a browser before opening one, say to tell its user that Chrome is wanted only when it is: a browser is needed when challenged or blocked is TRUE. fetch() and read_page() make the same probe first themselves, so there is no need to probe before calling them. Each probe is a request from this address, and counts towards the bursts that make a host tighten its check (see fetch()).

Value

A list: reachable, status (NA when unreachable), challenged (is_challenge()), blocked (is_block()), type (the content-type, lower case), size (bytes, from content-range or content-length, NA when unknown) and headers (a named list). A browser is called for when challenged or blocked is TRUE.

Examples

## Not run: 
probe("https://www12.statcan.gc.ca/census-recensement/index-eng.cfm")

## End(Not run)

safeconduct documentation built on Dec. 3, 2026, 1:07 a.m.