File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 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> {
11201120 }
11211121 input = remaining;
11221122 }
1123+
1124+ if !has_any_digit && context == Context :: Setter && !input. is_empty ( ) {
1125+ return Err ( ParseError :: InvalidPort ) ;
1126+ }
1127+
11231128 let mut opt_port = Some ( port as u16 ) ;
11241129 if !has_any_digit || opt_port == default_port ( ) {
11251130 opt_port = None ;
Original file line number Diff line number Diff line change 3939<non-spec:/.//p> set hostname to <h>
4040<non-spec:/.//p> set hostname to <>
4141<foo:///some/path> set pathname to <>
42- <http://example.net:8080/path> set port to <randomstring>
4342<file:///var/log/system.log> set href to <http://0300.168.0xF0>
4443<file://monkey/> set pathname to <\\\\>
4544<file:///unicorn> set pathname to <//\\/>
Original file line number Diff line number Diff line change @@ -1316,3 +1316,10 @@ fn issue_864() {
13161316 url. set_path ( "x" ) ;
13171317 dbg ! ( & url) ;
13181318}
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