Re: setting header in as3



On Jan 15, 6:06 am, haris <mfha...@xxxxxxxxx> wrote:
hi all,

I cant set request headers in flash AS3. Actually i m trying to
download file from S3 Amazon Bucket, which can only be allowed if
custom header is set in a request. I m trying to set that, but when I
check the request Packets from Etheral or WireShark, the request
doesn't contain any of mine custom header.

here is my flash download code;

var headers:Array = new Array();

var authHeader:URLRequestHeader = new URLRequestHeader
("Authorization","AWS: "+accesskey+":"+signature);
var dateHeader:URLRequestHeader = new URLRequestHeader("x-amz-
date",date);

request.url = domainUrl+objectkey;
request.method = URLRequestMethod.GET;
headers.push(authHeader);
headers.push(dateHeader);

request.requestHeaders = headers;

trace('request:'+request.requestHeaders.length);

try {
        loader.load(request);}catch (error:Error) {

        trace("Unable to load requested document.");

}

Remember I uploaded crossdomain.xml in the bucket with polies
mentioned as under;

<cross-domain-policy>
   <allow-access-from domain="*" secure="false" />
   <site-control permitted-cross-domain-policies="all"/>
   <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

In order to download file from Amazon Bucket the Request Packet should
be;

GET /<bucketname>/<filename>HTTP/1.1
x-flash-version: 10,0,2,54
User-Agent: Shockwave Flash
Host: s3.amazonaws.com
Authorization: AWS:<accesskey>:<signature>
x-amz-date: <date>

but after doing all the above work my final request sent to amazon;

GET /<bucketname>/<filename>HTTP/1.1
x-flash-version: 10,0,2,54
User-Agent: Shockwave Flash
Host: s3.amazonaws.com

:( no custom header here;
plz can anyone suggests

Same issue here. Any help would be much appreciated
.



Relevant Pages