File tree Expand file tree Collapse file tree
core/src/avm2/globals/flash/net Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,16 +31,27 @@ pub fn connect<'gc>(
3131
3232 if let Some ( url) = url {
3333 let url_lower = url. to_ascii_lowercase ( ) ;
34-
35- if url_lower. starts_with ( WStr :: from_units ( b"http://" ) )
36- || url_lower. starts_with ( WStr :: from_units ( b"https://" ) )
37- {
34+ let is_already_http = url_lower. starts_with ( WStr :: from_units ( b"http://" ) )
35+ || url_lower. starts_with ( WStr :: from_units ( b"https://" ) ) ;
36+
37+ // Already-absolute HTTP(S) URLs are passed through unchanged. Other URLs
38+ // are resolved against the SWF's location so that relative HTTP(S) paths
39+ // reach Flash Remoting, matching URLLoader.load() behavior. Closes #23201.
40+ let http_url = if is_already_http {
41+ Some ( url. to_string ( ) )
42+ } else {
43+ let url_string = url. to_string ( ) ;
44+ activation
45+ . context
46+ . navigator
47+ . resolve_url ( & url_string)
48+ . ok ( )
49+ . and_then ( |u| matches ! ( u. scheme( ) , "http" | "https" ) . then ( || u. to_string ( ) ) )
50+ } ;
51+
52+ if let Some ( http_url) = http_url {
3853 // HTTP(S) is for Flash Remoting, which is just POST requests to the URL.
39- NetConnections :: connect_to_flash_remoting (
40- activation. context ,
41- connection,
42- url. to_string ( ) ,
43- ) ;
54+ NetConnections :: connect_to_flash_remoting ( activation. context , connection, http_url) ;
4455 } else {
4556 avm2_stub_method ! (
4657 activation,
You can’t perform that action at this time.
0 commit comments