hprose unity http server

IsCrossDomainEnabled设置:
mServer.IsCrossDomainEnabled = true;

CrossDomainXmlContent设置:
//mServer.CrossDomainXmlContent = 
//  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!DOCTYPE cross-domain-policy SYSTEM\n\n\t\"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\" >\n\n<cross-domain-policy>\n\n\t<site-control permitted-cross-domain-policies=\"all\" />\n\n\t<allow-access-from domain=\"*\" />\n\n\t<allow-http-request-headers-from domain=\"*\" headers=\"*\"/>\n\n</cross-domain-policy>";

curl命令:
curl -d "Cs14\"sendSimpleText\"a1{s5\"world\"}z" http://192.168.1.105:4321/

Nepenthes:
http://www.hprose.com/test/
监听Is
Cross
Domain
Enabled
Cross
Domain
Xml
Content
curlNepenthes
http://192.168.1.105:4321false未设置failfail
http://192.168.1.105:4321/false未设置okfail
http://192.168.1.105:4321/true未设置okok
http://192.168.1.105:4321/true设置okok
http://0.0.0.0:4321/true设置okok
http://0.0.0.0:4321/true未设置okok
http://127.0.0.1:4321/true设置Bad Request (Invalid host)Bad Request (Invalid host)
http://localhost:4321/true设置Bad Request (Invalid host)Bad Request (Invalid host)

如果本地clone Nepenthes,非跨域,也可正常访问。
结论:
1. 端口后没有加/不能正常监听!
2. 如果设置http://127.0.0.1:port/http://localhost:port/ 只能本地访问。
3. 如果局域网访问,设置http://0.0.0.0:port/ 可避免需要绑定具体的端口。
4. 如果希望跨域访问,还需要设置IsCrossDomainEnabled。
5. 如果希望支持flash的跨域访问,还需要设置CrossDomainXmlContent。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值