File tree 3 files changed +12
-1
lines changed
3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -1120,6 +1120,11 @@ impl<'a> Parser<'a> {
1120
1120
}
1121
1121
input = remaining;
1122
1122
}
1123
+
1124
+ if !has_any_digit && context == Context :: Setter && !input. is_empty ( ) {
1125
+ return Err ( ParseError :: InvalidPort ) ;
1126
+ }
1127
+
1123
1128
let mut opt_port = Some ( port as u16 ) ;
1124
1129
if !has_any_digit || opt_port == default_port ( ) {
1125
1130
opt_port = None ;
Original file line number Diff line number Diff line change 39
39
<non-spec:/.//p> set hostname to <h>
40
40
<non-spec:/.//p> set hostname to <>
41
41
<foo:///some/path> set pathname to <>
42
- <http://example.net:8080/path> set port to <randomstring>
43
42
<file:///var/log/system.log> set href to <http://0300.168.0xF0>
44
43
<file://monkey/> set pathname to <\\\\>
45
44
<file:///unicorn> set pathname to <//\\/>
Original file line number Diff line number Diff line change @@ -1316,3 +1316,10 @@ fn issue_864() {
1316
1316
url. set_path ( "x" ) ;
1317
1317
dbg ! ( & url) ;
1318
1318
}
1319
+
1320
+ #[ test]
1321
+ fn issue_974 ( ) {
1322
+ let mut url = url:: Url :: parse ( "http://example.com:8000" ) . unwrap ( ) ;
1323
+ let _ = url:: quirks:: set_port ( & mut url, "\u{0000} 9000" ) ;
1324
+ assert_eq ! ( url. port( ) , Some ( 8000 ) ) ;
1325
+ }
You can’t perform that action at this time.
0 commit comments