You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jan Piotrowski (Sujan) (JIRA)" <ji...@apache.org> on 2018/01/22 21:54:00 UTC

[jira] [Updated] (CB-9285) Cordova application freezes if uploading a file through http proxy with ntlm authentication

     [ https://issues.apache.org/jira/browse/CB-9285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Piotrowski (Sujan) updated CB-9285:
---------------------------------------
    Description: 
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:

{code}
        <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>
        
{code}

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.)


  was:
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.)



> 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: cordova-windows
>    Affects Versions: 3.8.0, 4.0.0
>         Environment: windows8.1 , http proxy is squid with ntlm authentication
>            Reporter: shim iya
>            Assignee: Jesse MacFadyen
>            Priority: Major
>              Labels: newbie
>
> 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:
> {code}
>         <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>
>         
> {code}
> 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
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org