pub struct Query {
pub protocol: String,
pub host: String,
pub path: String,
}Expand description
The fields git credential expects on stdin, and that Helper
implementations key on.
Mirrors the subset of git-credential input upstream LFS sends:
protocol, host, path. username is intentionally not
pre-populated from the URL; helpers may fill it in themselves.
Fields§
§protocol: StringURL scheme (https, http, ssh, …).
host: StringHost portion, with :port suffix when the URL specifies one.
path: StringPath portion. Empty string means “no path”, which omits the
path= line on stdin to git-credential. Helpers that key on path
(e.g. credential.<url>.useHttpPath) only see this when the
caller decides to pass it.
Implementations§
Source§impl Query
impl Query
Sourcepub fn from_url(url: &Url) -> Self
pub fn from_url(url: &Url) -> Self
Build a query from a URL.
path is included by default; callers that want host-only
matching (the upstream default) should clear it via
Self::without_path. The path is percent-decoded to
match what upstream LFS sends to git credential (Go’s
url.URL.Path is the decoded form), which lets
git credential’s protectProtocol check see real
newlines / NULs / CRs in hostile URLs rather than their %0a /
%00 / %0d forms.
Sourcepub fn without_path(self) -> Self
pub fn without_path(self) -> Self
Variant with the path cleared.
Matches the default git credential behavior, which scopes by
host only unless useHttpPath is set.