Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/uri/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,6 @@ mod tests {
assert_eq!(uri.scheme(), Some(&Scheme::HTTPS));
assert_eq!(uri.host(), Some("example.com"));
assert_eq!(uri.path(), "*");
assert_eq!(uri.to_string(), "https://example.com");
}
}
6 changes: 5 additions & 1 deletion src/uri/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,11 @@ impl fmt::Display for Uri {
f.write_str(authority.as_str())?;
}

f.write_str(self.path())?;
// RFC 9112 3.2.4: the absolute-form of an asterisk-form target has an
// empty path. Writing the `*` would make it part of the authority.
if self.authority().is_none() || self.path() != "*" {
f.write_str(self.path())?;
}

if let Some(query) = self.query() {
f.write_str("?")?;
Expand Down
Loading