weburl

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package weburl holds what mimicry shares about URLs as browsers send them (the WHATWG URL standard, as the urls capture measures it): the percent-encode sets every browser measured applies, and a URL's path serialized as mimicry's canonical form leaves it, where Go's own (url.URL.EscapedPath) would encode characters a browser sends as they are ('|' for Firefox and Safari).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InPathSet

func InPathSet(c byte) bool

InPathSet reports whether c is in the path percent-encode set as every browser measured applies it: the query set, '?', '^', '`', '{' and '}'. A browser may encode more (profile.URLs.PathEncodes: '|' for Chrome).

func InQuerySet

func InQuerySet(c byte) bool

InQuerySet reports whether c is in the URL standard's query percent-encode set: C0 controls, space, '"', '#', '<', '>' and every byte above '~'.

func OpaquePath

func OpaquePath(opaque string) string

OpaquePath is the path an http(s) URL's Opaque names, as net/http and x/net/http2 read it: "/raw/path" itself, "//host/raw/path" without its authority ("/" for none).

func Path

func Path(u *url.URL) string

Path is u's path as sent: with Opaque, the caller's own (OpaquePath); else RawPath when set (mimicry's canonical form sets it to what the browser sends), else Go's EscapedPath; "/" for none.

func PercentEncode

func PercentEncode(s string, in func(byte) bool) string

PercentEncode percent-encodes the bytes of s that in reports, keeping every other byte (a % included) as it is.

func RequestURI

func RequestURI(u *url.URL) string

RequestURI is u's request target in origin form: Path, then the query.

func String

func String(u *url.URL) string

String is u.String() with its path as Path has it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL