Skip to contents

Expands a named profile into the resolved bundle of low-level parser knobs it sets, running the exact same resolution the parse functions (safe_parse_url, safe_parse_urls, get_clean_url) apply when you pass profile. It never parses a URL; it answers “what does this profile actually do, and did my explicit overrides change it?”.

Usage

url_profile(profile = NULL, ...)

Arguments

profile

A single profile name: one of "browser", "whatwg", "rfc-syntax", "seo", or the "seo" alias "canonical".

...

Optional explicit knob overrides (e.g. scheme_policy = "require"), named as in safe_parse_url. Each override that the profile also sets replaces the profile's value and marks the result customized.

Value

A named list of the resolved knob \(\rightarrow\) value pairs the profile sets (the same shape as an internal profile bundle), plus a trailing logical customized element.

Details

Profiles are inspectable sugar that bundle the parser's acceptance, interpretation, leniency, and canonicalization axes under one name. Explicit arguments always override the profile (the iron rule); when any override is supplied, the resolved result is flagged customized = TRUE and rurl no longer claims the result matches the named profile exactly.

The recognized profiles are "browser" (browser-like http-prepending fix-up posture; not Chrome-faithful), "whatwg" (absolute-URL, no-base spec posture that rejects scheme-less input), "rfc-syntax" (RFC 3986 generic syntax as parsing, not normalization: case and dot-segments are preserved), and "seo" (rurl's origin-cleaning intent; "canonical" is an alias resolving identically to "seo").

Examples

url_profile("browser")
#> $url_standard
#> [1] "whatwg"
#> 
#> $scheme_acceptance
#> [1] "general"
#> 
#> $scheme_policy
#> [1] "infer"
#> 
#> $scheme_relative_handling
#> [1] "http"
#> 
#> $fixup_posture
#> [1] "browser"
#> 
#> $customized
#> [1] FALSE
#> 
url_profile("seo")
#> $scheme_acceptance
#> [1] "web"
#> 
#> $protocol_handling
#> [1] "https"
#> 
#> $www_handling
#> [1] "strip"
#> 
#> $trailing_slash_handling
#> [1] "strip"
#> 
#> $index_page_handling
#> [1] "strip"
#> 
#> $query_handling
#> [1] "filter"
#> 
#> $customized
#> [1] FALSE
#> 
# canonical is an alias of seo:
identical(url_profile("canonical"), url_profile("seo"))
#> [1] TRUE
# explicit overrides win and flag the result customized:
url_profile("browser", scheme_policy = "require")
#> $url_standard
#> [1] "whatwg"
#> 
#> $scheme_acceptance
#> [1] "general"
#> 
#> $scheme_policy
#> [1] "require"
#> 
#> $scheme_relative_handling
#> [1] "http"
#> 
#> $fixup_posture
#> [1] "browser"
#> 
#> $customized
#> [1] TRUE
#>