2

我们的应用程序中有图像上传功能。此功能在我们使用 HTTP 时工作正常,但在启用 SSL 时失败。经过一些网上冲浪后,我得到了一些代码,即在上传方法中添加 true 属性

ft.upload(fileuri, encodeURI(PublishUrl+"FileUpload"), win, fail, options,true);

但它没有用

错误日志

07-11 19:44:40.651: E/FileTransfer(17526):    {"target":"Url","source":"file:\/\/\/storage\/emulated\/0\/PopImg\/cache\/Car\/Crazy_Racer\/sm_1_(10).jpg","http_status":0,"code":3}
07-11 19:44:40.651: E/FileTransfer(17526): java.net.SocketException: Socket is closed
07-11 19:44:40.651: E/FileTransfer(17526):            at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.checkOpen(OpenSSLSocketImpl.java:232)
07-11 19:44:40.651: E/FileTransfer(17526):            at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:245)
07-11 19:44:40.651: E/FileTransfer(17526):            at libcore.net.http.HttpConnection.setupSecureSocket(HttpConnection.java:209)
07-11 19:44:40.651: E/FileTransfer(17526):            at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:478)
07-11 19:44:40.651: E/FileTransfer(17526):            at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:442)
07-11 19:44:40.651: E/FileTransfer(17526):            at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290)
07-11 19:44:40.651: E/FileTransfer(17526):            at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240)
07-11 19:44:40.651: E/FileTransfer(17526):            at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81)
07-11 19:44:40.651: E/FileTransfer(17526):            at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:165)
07-11 19:44:40.651: E/FileTransfer(17526):            at org.apache.cordova.FileTransfer$1.run(FileTransfer.java:344)
07-11 19:44:40.651: E/FileTransfer(17526):            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-11 19:44:40.651: E/FileTransfer(17526):            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-11 19:44:40.651: E/FileTransfer(17526):            at java.lang.Thread.run(Thread.java:856)
07-11 19:44:40.651: E/FileTransfer(17526): Failed after uploading 0 of 18171 bytes.

任何建议如何解决这个问题?

4

1 回答 1

0

出于测试目的,我的移动流量是通过 Fiddler 路由的。Android 设备可能无法使用 Fiddler 使用的默认 HTTPS 拦截证书。通过禁用提琴手它起作用了。

于 2013-12-14T06:31:04.110 回答