开发者

How do you read and write http headers in ActionScript?

开发者 https://www.devze.com 2023-02-02 16:29 出处:网络
Is it e开发者_如何学Cven possible to both read and write http headers in actionscript?Hmm... ok setting them doesn\'t seem to be a problem.

Is it e开发者_如何学Cven possible to both read and write http headers in actionscript?


Hmm... ok setting them doesn't seem to be a problem.

Pretty straight forward, you just add and array of URLRequestHeader objects to the URLRequest object.

var req:URLRequest = new URLRequest();
var someheader:URLRequestHeader = new URLRequestHeader( "Connection", "OK" );
req.requestHeaders = [someheader];

However, you can't read them in the regular FlashPlayer. This can be done in AIR and Flash Lite on using the requestHeader property on the HTTPStatusEvent.

var loader:URLLoader = new URLLoader();
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onStatus);

private function onStatus( e:HTTPStatusEvent ) : void
{
    var headers:Array = e.requestHeaders; // only available in FlashLite and AIR  
}

This is kinda weird.

0

精彩评论

暂无评论...
验证码 换一张
取 消