I've run into an interesting problem with URLRequest, navigateToURL, and
ByteArray when sending a zero byte:

var bytes:ByteArray = new ByteArray();
bytes.writeByte(1);
bytes.writeByte(1);
bytes.writeByte(1);
bytes.writeByte(1);
        
requestHeader = new URLRequestHeader("Content-type",
"application/octet-stream");
// Where ../../test is just a valid dummy url--it doesn't matter what it
// actually does with the request
request:URLRequest = new URLRequest("../../test");
request.requestHeaders.push(header);
request.method = URLRequestMethod.POST;
request.data = bytes;
navigateToURL(request, "_blank");


I write four bytes above, because that seems to be a minimum for
URLRequest (if I write just one byte, the Content-Length header is set
to 4 anyway), but that's a separate issue.

If I change one of those

bytes.writeByte(1)

to

bytes.writeByte(0)

The byte array seems to be truncated to the location of that byte. In
general, any ByteArray sent as a data property payload of a URLRequest
seems to be truncated to the location of the first zero byte. I've
confirmed this by checking the Content-Length header of the POST request
(in fact, if the *first* byte is zero, the request seems to be turned
into a GET--which is even weirder).

I'm using FP 9.0.124.0 on Linux. I just tested on a colleague's machine,
and this seems to work fine in FP on Vista. Is this a known issue? Is
there any way around this?


-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com


Reply via email to