Skip to content

Commit 869a784

Browse files
committed
add tests for fragment and userinfo URLs
1 parent ba9297e commit 869a784

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/tests.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,45 @@ fn full_header_preset() {
244244
);
245245
}
246246

247+
#[test]
248+
/// - URLS with fragments are rejected
249+
fn fragment() {
250+
let page = get(
251+
&["--addr", "[::]:1983", "--hostname", "example.com"],
252+
addr(1983),
253+
"gemini://example.com/#fragment",
254+
)
255+
.expect("could not get page");
256+
257+
assert_eq!(page.header.status, Status::BadRequest);
258+
}
259+
260+
#[test]
261+
/// - URLS with username are rejected
262+
fn username() {
263+
let page = get(
264+
&["--addr", "[::]:1984", "--hostname", "example.com"],
265+
addr(1984),
266+
"gemini://user@example.com/",
267+
)
268+
.expect("could not get page");
269+
270+
assert_eq!(page.header.status, Status::BadRequest);
271+
}
272+
273+
#[test]
274+
/// - URLS with password are rejected
275+
fn password() {
276+
let page = get(
277+
&["--addr", "[::]:1984", "--hostname", "example.com"],
278+
addr(1984),
279+
"gemini://:secret@example.com/",
280+
)
281+
.expect("could not get page");
282+
283+
assert_eq!(page.header.status, Status::BadRequest);
284+
}
285+
247286
#[test]
248287
/// - hostname is checked when provided
249288
/// - status for wrong host is "proxy request refused"

0 commit comments

Comments
 (0)