定制标题可能与的URLRequest / URLStream使用方法得到什么呢? [英] Custom headers possible with URLRequest/URLStream using method GET?
问题描述
真的很简单:
var req:URLRequest=new URLRequest();
req.url="http://somesite.com";
var header:URLRequestHeader=new URLRequestHeader("my-bespoke-header","1");
req.requestHeaders.push(header);
req.method=URLRequestMethod.GET;
stream.load(req);
不过,如果我检查交通使用Wireshark的我-定制的头
不被发送。如果我更改为 URLRequestMethod.POST
和追加一些数据,以 req.data code>,然后头被发送,但接收应用程序需要一个GET而不是POST。
Yet, if I inspect the traffic with WireShark, the my-bespoke-header
is not being sent. If I change to URLRequestMethod.POST
and append some data to req.data
, then the header is sent, but the receiving application requires a GET not a POST.
说明文档中提到的头一个黑名单,将不会被发送。 我-定制的头
是不是其中之一。这可能是值得一提的是,发起请求来自同一个域不同的端口。没有报道在policyfile日志,因此它似乎不太可能,但就是这个东西,可以强行加载与允许-HTTP请求报头 - 从$ C $一个crossdomain.xml的予以纠正C>尽管这不是一个跨域的问题?还是纯粹的Flash Player无证功能,它只能发送自定义页眉与POST请求?
The documentation mentions a blacklist of headers that will not get sent. my-bespoke-header
is not one of these. It's possibly worth mentioning that the originating request is from a different port on the same domain. Nothing is reported in the policyfile log, so it seems unlikely, but is this something that can be remedied by force loading a crossdomain.xml with a allow-http-request-headers-from
despite the fact that this is not a crossdomain issue? Or is it simply an undocumented feature of the Flash Player that it can only send custom headers with a POST request?
推荐答案
据我所知,好像你的是,没有自定义标头的假设为HTTP GET支持确实是无证功能(或错误?)的标准库。
From what I can gather, it seems like your assumption about the lack of custom headers support for HTTP GET is indeed an undocumented feature (or a bug?) in the standard libraries.
在任何情况下,你可能想看看 as3httpclient 会适合你的目的,让你的工作解决此问题。下面是一个帖子在这个库的开发者的博客相关代码段:
In any case, you might want to see if as3httpclient would fit your purposes and let you work around this issue. Here's a relevant snippet from a post in the blog of the developer of this library:
我无法设置的头 HTTP / GET请求。 Macromedia公司的Flash 播放器允许您只设置页眉 POST请求。我讨论过这个 特德·帕特里克和他的问题告诉我 我怎么能我们SOCKET实现 期望他非常客气的给 我code-片段,这让我 开始了。的
"I was not able to set the header of a HTTP/GET request. Macromedia Flash Player allows you set the header only for POST requests. I discussed this issues with Ted Patrick and he told me how I can us Socket to achieve the desired and he was very kind to give a me code-snippet, which got me started."
这篇关于定制标题可能与的URLRequest / URLStream使用方法得到什么呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!