[TIMOB-23986] Android: BasicAuth requests fail.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 5.5.1 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Michael Bahl |
Assignee | Unknown |
Created | 2016-09-10T17:09:08.000+0000 |
Updated | 2018-02-28T19:55:04.000+0000 |
Description
Http requests on android against BasicAuth protected pages fail,
when multiple requests are fired before the previous request is completed.
I have created a sample project which allows you to send single
http requests (x1) which will work and you can execute 10 requests (x10) in a row.
The first 5 requests will be executed every 5 seconds,
these requests will work as expected.
From the sixth request on all remaining 5 requests get fired at once
and cause an issue.
Sample project: https://github.com/MichelBahl/AC-4446
*Hint:* I watched into network traffic with wireshark, I recognized that when I execute a BasicAuth request the android network module starts two http requests, the first without credentials,
these requests ends up with an 401 error, the second one with credentials works as expected,
maybe the issue I described is related to this flaw in the network module.
*Error Message:*
[ERROR] TiHTTPClient: (TiHttpClient-10) [66387,66387] HTTP Error (java.io.IOException): 401 : Access Denied
[ERROR] TiHTTPClient: java.io.IOException: 401 : Access Denied
[ERROR] TiHTTPClient: at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1227)
[ERROR] TiHTTPClient: at java.lang.Thread.run(Thread.java:818)
[ERROR] TiHTTPClient: (TiHttpClient-12) [3,66390] HTTP Error (java.io.IOException): 401 : Access Denied
[ERROR] TiHTTPClient: java.io.IOException: 401 : Access Denied
[ERROR] TiHTTPClient: at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1227)
[ERROR] TiHTTPClient: at java.lang.Thread.run(Thread.java:818)
[ERROR] XMLModule: (main) [3,66393] Error parsing XML
[ERROR] XMLModule: org.xml.sax.SAXParseException: Unexpected token (position:TEXT You do not have ...@1:59 in java.io.InputStreamReader@e79ec62)
[ERROR] XMLModule: at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:146)
[ERROR] XMLModule: at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)
[ERROR] XMLModule: at ti.modules.titanium.xml.XMLModule.parse(XMLModule.java:82)
[ERROR] XMLModule: at ti.modules.titanium.xml.XMLModule.parse(XMLModule.java:68)
[ERROR] XMLModule: at ti.modules.titanium.network.TiHTTPClient.getResponseXML(TiHTTPClient.java:562)
[ERROR] XMLModule: at ti.modules.titanium.network.HTTPClientProxy.getResponseXML(HTTPClientProxy.java:129)
[ERROR] XMLModule: at org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method)
[ERROR] XMLModule: at org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:73)
[ERROR] XMLModule: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1155)
[ERROR] XMLModule: at android.os.Handler.dispatchMessage(Handler.java:98)
[ERROR] XMLModule: at android.os.Looper.loop(Looper.java:148)
[ERROR] XMLModule: at android.app.ActivityThread.main(ActivityThread.java:5417)
[ERROR] XMLModule: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] XMLModule: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[ERROR] XMLModule: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
[ERROR] TiHTTPClient: (main) [2,66395] Error parsing XML
[ERROR] TiHTTPClient: org.xml.sax.SAXParseException: Unexpected token (position:TEXT You do not have ...@1:59 in java.io.InputStreamReader@e79ec62)
[ERROR] TiHTTPClient: at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:146)
[ERROR] TiHTTPClient: at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)
[ERROR] TiHTTPClient: at ti.modules.titanium.xml.XMLModule.parse(XMLModule.java:82)
[ERROR] TiHTTPClient: at ti.modules.titanium.xml.XMLModule.parse(XMLModule.java:68)
[ERROR] TiHTTPClient: at ti.modules.titanium.network.TiHTTPClient.getResponseXML(TiHTTPClient.java:562)
[ERROR] TiHTTPClient: at ti.modules.titanium.network.HTTPClientProxy.getResponseXML(HTTPClientProxy.java:129)
[ERROR] TiHTTPClient: at org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method)
[ERROR] TiHTTPClient: at org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:73)
[ERROR] TiHTTPClient: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1155)
[ERROR] TiHTTPClient: at android.os.Handler.dispatchMessage(Handler.java:98)
[ERROR] TiHTTPClient: at android.os.Looper.loop(Looper.java:148)
[ERROR] TiHTTPClient: at android.app.ActivityThread.main(ActivityThread.java:5417)
[ERROR] TiHTTPClient: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiHTTPClient: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[ERROR] TiHTTPClient: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Hello, I can reproduce the issue with the sample code provided. For me the issue occur on the seventh request. Below is the error log for my test
I am testing on
Thanks.