Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
Fixes HTTP status event
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydelendik committed Nov 25, 2013
1 parent bdfe8cd commit 58e9693
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/flash/net/NetStream.js
Expand Up @@ -160,14 +160,14 @@ var NetStreamDefinition = (function () {
request._checkPolicyFile = this._checkPolicyFile;
var stream = new flash.net.URLStream();
stream._addEventListener('httpStatus', function (e) {
var responseHeaders = e[Multiname.getPublicQualifiedName('responseHeaders')];
var responseHeaders = e.asGetPublicProperty('responseHeaders');
var contentTypeHeader = responseHeaders.filter(function (h) {
return h[Multiname.getPublicQualifiedName('name')] === 'Content-Type';
return h.asGetPublicProperty('name') === 'Content-Type';
})[0];
if (contentTypeHeader &&
contentTypeHeader[Multiname.getPublicQualifiedName('value')] !==
contentTypeHeader.asGetPublicProperty('value') !==
'application/octet-stream') {
this._contentTypeHint = contentTypeHeader[Multiname.getPublicQualifiedName('value')];
this._contentTypeHint = contentTypeHeader.asGetPublicProperty('value');
}
}.bind(this));
stream._addEventListener('progress', function (e) {
Expand Down
7 changes: 3 additions & 4 deletions src/flash/net/URLStream.js
Expand Up @@ -69,7 +69,7 @@ var URLStreamDefinition = (function () {
var httpStatusEvent = HTTPStatusEventClass.createInstance([
'httpStatus', false, false, httpStatus]);
var headers = [];
httpHeaders.split(/\r\n/g).forEach(function (h) {
httpHeaders.split(/(?:\n|\r?\n)/g).forEach(function (h) {
var m = /^([^:]+): (.*)$/.exec(h);
if (m) {
headers.push(URLRequestHeaderClass.createInstance([m[1], m[2]]));
Expand All @@ -78,9 +78,8 @@ var URLStreamDefinition = (function () {
}
}
});

httpStatusEvent.public$responseHeaders = headers;
httpStatusEvent.public$responseURL = location;
httpStatusEvent.asSetPublicProperty('responseHeaders', headers);
httpStatusEvent.asSetPublicProperty('responseURL', location);
self._dispatchEvent(httpStatusEvent);
};
session.onclose = function () {
Expand Down

0 comments on commit 58e9693

Please sign in to comment.