SWF(使用 URLLoader)可以访问 HTTPS Web 服务吗?

发布于 2024-08-04 11:10:40 字数 757 浏览 4 评论 0原文

我有一个 fla(使用 ActionScript 3.0),我正在 Flash 中进行编译。我正在使用 URLRequest 和 URLLoader 访问 http web 服务。

var loader:URLLoader = new URLLoader();     
var request:URLRequest = new URLRequest("http:test.webservice.com");    
try {
   loader.load(request);
} catch (error:Error) {
   trace("Unable to load requested document.");
}

这工作正常 - 但是如果我尝试访问 https 地址,我会得到

httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://test.webservice.com"]

How can Iretrieve data from a https web service? SWF 是否必须托管在 SSL 安全页面上?

I have a fla (using ActionScript 3.0) I am compiling in Flash. I am using URLRequest and URLLoader to access a http webservice.

var loader:URLLoader = new URLLoader();     
var request:URLRequest = new URLRequest("http:test.webservice.com");    
try {
   loader.load(request);
} catch (error:Error) {
   trace("Unable to load requested document.");
}

This works fine - however if I try and access a https address I get

httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://test.webservice.com"]

How can I retrieve data from a https web service? Does the SWF have to be hosted on a SSL secured page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北渚 2024-08-11 11:10:40

如果您安装了 Flash 调试播放器,您可能会在日志中看到以下内容:

** Security Sandbox Violation ***
Connection to https://www.example.com/service/ halted - not permitted from http://www.example.com/your.swf

Error: Request for resource at https://www.example.com/service/ by requestor from http://www.example.com/your.swf is denied due to lack of policy file permissions.

默认情况下,http 中托管的 swf 无法访问 https — 它被视为不同的域。

您需要设置适当的 crossdomain.xml 策略文件,并小心验证 Content-Type 是 text/* 或其他列入白名单的值。此外,您还需要一个带有“secure=false”的元策略文件,该文件将允许从 http 访问 https。

  <allow-access-from domain="www.example.com" secure="false" />

进一步阅读:

Flash Player 9 和 Flash Player 10 中的策略文件更改

If you install the flash debug player, you'll probably see the following in the log:

** Security Sandbox Violation ***
Connection to https://www.example.com/service/ halted - not permitted from http://www.example.com/your.swf

Error: Request for resource at https://www.example.com/service/ by requestor from http://www.example.com/your.swf is denied due to lack of policy file permissions.

By default a swf hosted in a http cannot access https --it's considered a different domain.

You'll need to set up the appropriate crossdomain.xml policy file, with care to verify the Content-Type is text/* or another whitelisted value. Additionally, you'll need a meta-policy file with "secure=false", which will allow https to be accessed from http.

  <allow-access-from domain="www.example.com" secure="false" />

Further reading:

Policy file changes in Flash Player 9 and Flash Player 10

暮倦 2024-08-11 11:10:40

检查actionscript文档中的跨域策略。
http://kb2.adobe.com/cps/142/tn_14213.html

安全服务器,允许访问通过非安全托管的电影
协议

不建议允许 HTTP 内容访问 HTTPS 内容。
这种做法可能会损害 HTTPS 提供的安全性。

但是,在某些情况下,可能允许旧版 Flash 内容
访问 HTTPS 站点的数据。有了 Flash Player 7,这不再是问题
默认允许。允许 Flash 影片访问 HTTPS 数据
通过 HTTP 提供服务,在“allow-access-from”标签中使用安全属性
并将其设置为 false。

 <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">


        <cross-domain-policy>


        <allow-access-from domain="www.company.com" secure="false" />


        </cross-domain-policy> 

它被保存为 crossdomain.xml 并放置在
HTTPS 服务器。

Check the crossdomain policy in the actionscript documentation.
http://kb2.adobe.com/cps/142/tn_14213.html

A secure server that allows access to movies hosted via a non-secure
protocol

It is not advisable to permit HTTP content to access HTTPS content.
This practice can compromise the security offered by HTTPS.

However, there may be cases where legacy Flash content is allowed
access to data of a HTTPS site. With Flash Player 7, this is no longer
allowed by default. To permit access to HTTPS data by Flash movies
served via HTTP, use the secure attribute in a "allow-access-from" tag
and set it to false.

 <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">


        <cross-domain-policy>


        <allow-access-from domain="www.company.com" secure="false" />


        </cross-domain-policy> 

It is saved as crossdomain.xml and placed on the site root of the
HTTPS server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文