shim iya created CB-9285:
----------------------------
Summary: Cordova application freezes if uploading a file through
http proxy with ntlm authentication
Key: CB-9285
URL: https://issues.apache.org/jira/browse/CB-9285
Project: Apache Cordova
Issue Type: Bug
Components: Windows 8
Affects Versions: 3.8.0, 4.0.0
Environment: windows8.1 , http proxy is squid with ntlm authentication
Reporter: shim iya
Assignee: Jesse MacFadyen
When uploading a file with Cordova Application through a http proxy with ntlm
authentication, Cordova application freezes.
My machine is surface pro 3.
"uploading a file" means , I created a FormData and add blob to the formdata
like this:
<script type="text/javascript">
document.getElementById('thisfile').addEventListener('change',
function () {
var imageFile = document.getElementById('thisfile').files[0];
var reader = new FileReader();
if (imageFile) {
reader.readAsDataURL(imageFile);
reader.onload = function () {
window.image = new Image();
window.image.src = reader.result;
};
}
});
document.getElementById('sendbutton').addEventListener('click',
function () {
var formdata = new FormData();
var d = window.atob(window.image.src.split(',')[1]);
var buff = new ArrayBuffer(d.length);
var arr = new Uint8Array(buff);
var i, dataLen;
for (i = 0, dataLen = d.length; i < dataLen; i++) {
arr[i] = d.charCodeAt(i);
}
var blob = new Blob([arr], { type: 'image/jpg' });
formdata.append("image", blob, "foo.jpg");
var option = {
url:
'http://someserver:8080/SomeApplication/service/SomeFunction',
data: formdata
};
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.onreadystatechange = function () {
if (this.readyState == 4
&& this.status == 200) {
navigator.notification.alert(this.responseText);
} else {
navigator.notification.alert('Access Failed.');
}
}
xmlHttpRequest.open('POST', option.url, true);
xmlHttpRequest.send(option.data);
});
</script>
In the first place, to communicate with ntlm authentication proxy, request is
threw 3 times.
First time, request is thrown with no request header 'proxy-authorization',
then the server responses 407.
Second time,request is thrown with request header 'proxy-authorization', and
this is authentication request, then the server responses 407, but this is
called "challange".
Third time, challange is solved, request is thrown with complete request header
'proxy-authorization' and succeed the authentication.
But...actually,
the second time of the request and response goes well, but the third time of
the request is not thrown.
Then,application freezes.Even doing anything, there is no reaction.
All I can do is kill the process using TaskManager.
And this go well unless I add a file to the formdata, so I don't think my
environment is corrupt.
Incidentally,If I look at the same script in IE11, this code will
succeed.(Neatly requests are thrown three times, all is succeeded.)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]