@@ -244,6 +244,45 @@ fn full_header_preset() {
244
244
) ;
245
245
}
246
246
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
+
247
286
#[ test]
248
287
/// - hostname is checked when provided
249
288
/// - status for wrong host is "proxy request refused"
0 commit comments