Flash 套接字策略 - 提供策略,但客户端中止与套接字的连接
我在端口 2400 上设置了一个服务。当我从 Flash 本身运行 Flash 客户端时,它运行良好,因为它绕过了安全策略。
当我尝试通过在桌面上或从浏览器运行 SWF 进行连接时,我看到了以下交换:
00000000 3c 70 6f 6c 69 63 79 2d 66 69 6c 65 2d 72 65 71 <policy- file-req
00000010 75 65 73 74 2f 3e 00 uest/>.
00000000 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 <?xml ve rsion="1
00000010 2e 30 22 3f 3e 3c 21 44 4f 43 54 59 50 45 20 63 .0"?><!D OCTYPE c
00000020 72 6f 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f 6c 69 ross-dom ain-poli
00000030 63 79 20 53 59 53 54 45 4d 20 22 68 74 74 70 3a cy SYSTE M "http:
00000040 2f 2f 77 77 77 2e 61 64 6f 62 65 2e 63 6f 6d 2f //www.ad obe.com/
00000050 78 6d 6c 2f 64 74 64 73 2f 63 72 6f 73 73 2d 64 xml/dtds /cross-d
00000060 6f 6d 61 69 6e 2d 70 6f 6c 69 63 79 2e 64 74 64 omain-po licy.dtd
00000070 22 3e 20 3c 63 72 6f 73 73 2d 64 6f 6d 61 69 6e "> <cros s-domain
00000080 2d 70 6f 6c 69 63 79 3e 20 3c 73 69 74 65 2d 63 -policy> <site-c
00000090 6f 6e 74 72 6f 6c 20 70 65 72 6d 69 74 74 65 64 ontrol p ermitted
000000A0 2d 63 72 6f 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f -cross-d omain-po
000000B0 6c 69 63 69 65 73 3d 22 6d 61 73 74 65 72 2d 6f licies=" master-o
000000C0 6e 6c 79 22 2f 3e 20 3c 61 6c 6c 6f 77 2d 61 63 nly"/> < allow-ac
000000D0 63 65 73 73 2d 66 72 6f 6d 20 64 6f 6d 61 69 6e cess-fro m domain
000000E0 3d 22 2a 22 20 74 6f 2d 70 6f 72 74 73 3d 22 2a ="*" to- ports="*
000000F0 22 20 2f 3e 3c 2f 63 72 6f 73 73 2d 64 6f 6d 61 " /></cr oss-doma
00000100 69 6e 2d 70 6f 6c 69 63 79 3e 00 in-polic y>.
因此您可以看到我在响应中正确包含了空终止符。
交换策略请求和所服务的策略文件后,会发生以下情况:
- 客户端向服务器端口 2400 发送 SYN
- 服务器响应 SYN、ACK
- 客户端发送 ACK
- 客户端发送 FIN、ACK
- 服务器响应 ACK
- 客户端发送 RST、ACK
我假设是这样客户端连接(步骤 1-3)然后中止(步骤 4-6)。 Flash 提供了此错误:
Error: Error #2048: Security sandbox violation: file:///C|/Projects/rbrnascar/trunk/Development/Websites/flash/SocialMap.swf cannot load data from robpaveza.net:2400. at com.redbull.model::SocialMapModel/onSecurityError() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::Socket/onTimeout() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()
我查看了以下页面,这些页面似乎表达了类似的问题,但没有解决方案
有没有人弄清楚这一点?
I have a service set up on port 2400. When I run the Flash client from Flash itself, it runs fine because it bypasses security policy.
When I try to connect by running the SWF on my desktop, or from the browser, I see this exchange:
00000000 3c 70 6f 6c 69 63 79 2d 66 69 6c 65 2d 72 65 71 <policy- file-req
00000010 75 65 73 74 2f 3e 00 uest/>.
00000000 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 <?xml ve rsion="1
00000010 2e 30 22 3f 3e 3c 21 44 4f 43 54 59 50 45 20 63 .0"?><!D OCTYPE c
00000020 72 6f 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f 6c 69 ross-dom ain-poli
00000030 63 79 20 53 59 53 54 45 4d 20 22 68 74 74 70 3a cy SYSTE M "http:
00000040 2f 2f 77 77 77 2e 61 64 6f 62 65 2e 63 6f 6d 2f //www.ad obe.com/
00000050 78 6d 6c 2f 64 74 64 73 2f 63 72 6f 73 73 2d 64 xml/dtds /cross-d
00000060 6f 6d 61 69 6e 2d 70 6f 6c 69 63 79 2e 64 74 64 omain-po licy.dtd
00000070 22 3e 20 3c 63 72 6f 73 73 2d 64 6f 6d 61 69 6e "> <cros s-domain
00000080 2d 70 6f 6c 69 63 79 3e 20 3c 73 69 74 65 2d 63 -policy> <site-c
00000090 6f 6e 74 72 6f 6c 20 70 65 72 6d 69 74 74 65 64 ontrol p ermitted
000000A0 2d 63 72 6f 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f -cross-d omain-po
000000B0 6c 69 63 69 65 73 3d 22 6d 61 73 74 65 72 2d 6f licies=" master-o
000000C0 6e 6c 79 22 2f 3e 20 3c 61 6c 6c 6f 77 2d 61 63 nly"/> < allow-ac
000000D0 63 65 73 73 2d 66 72 6f 6d 20 64 6f 6d 61 69 6e cess-fro m domain
000000E0 3d 22 2a 22 20 74 6f 2d 70 6f 72 74 73 3d 22 2a ="*" to- ports="*
000000F0 22 20 2f 3e 3c 2f 63 72 6f 73 73 2d 64 6f 6d 61 " /></cr oss-doma
00000100 69 6e 2d 70 6f 6c 69 63 79 3e 00 in-polic y>.
So you can see that I'm correctly including the null terminator in the response.
After the exchange of the policy request and policy file being served, the following happens:
- Client sends SYN to server port 2400
- Server responds SYN, ACK
- Client sends ACK
- Client sends FIN, ACK
- Server responds ACK
- Client sends RST, ACK
I'm assuming this is the client connecting (steps 1-3) then aborting (steps 4-6). Flash provides this error:
Error: Error #2048: Security sandbox violation: file:///C|/Projects/rbrnascar/trunk/Development/Websites/flash/SocialMap.swf cannot load data from robpaveza.net:2400. at com.redbull.model::SocialMapModel/onSecurityError() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::Socket/onTimeout() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()
I've looked at the following pages, which seem to express similar troubles but no resolutions
- Trouble getting Flash socket policy file to work
- Adobe Socket Policy File Server Problems
- flash socket policy
- Flash doesn't connect to socket even though policy allows it
Has anyone figured this out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保客户端的超时设置以毫秒为单位,而不是秒。
Make sure that the client's timeout is set in milliseconds, not seconds.
我有。在策略文件末尾后发送空字符 \0。
以下是我的做法(用 C# 写入 StreamWriter)
I have. Send the null character \0 after the end of the policy file.
Here's how I would go about doing it (writing to a StreamWriter in C#)