android - SSLException due uploading item for Amazon service -
i upload file aws service android. configured this:
awsmetadata awsmetadata = resultdata.getparcelable(params.commandmessage.extra_message); awscredentials awscredentials = new basicawscredentials( awsmetadata.getaccountid(), awsmetadata.getsecretkey() ); // set region transfermanager transfermanager = new transfermanager(awscredentials); region region = region.getregion(regions.fromname(awsmetadata.getregionendpoint())); transfermanager.getamazons3client().setregion(region); final mediaitem mediaitem = datasource.get(0); log.d(app.tag, "file exists: " + mediaitem.getcontenturi() + " " + new file(mediaitem.getcontenturi()).exists()); // prepare file upload putobjectrequest putobjectrequest = new putobjectrequest( awsmetadata.getbucketname(), awsmetadata.getsecretkey(), new file(mediaitem.getcontenturi()) ); log.d(app.tag, "total data: " + mediaitem.getsize()); upload upload = transfermanager.upload(putobjectrequest, new s3progresslistener() { private int totaltransfered = 0; @override public void onpersistabletransfer(persistabletransfer persistabletransfer) { } @override public void progresschanged(progressevent progressevent) { log.d(app.tag, "bytes transferred: " + progressevent.getbytestransferred()); totaltransfered += progressevent.getbytestransferred(); long totalsize = mediaitem.getsize(); log.d(app.tag, "total transferred: " + ((totaltransfered / totalsize) * 100) + " percent"); } }); }
and got sslexception:
06-01 11:45:00.712 5182-5768/com.home i/amazonhttpclient﹕ unable execute http request: write error: ssl=0xb4bb3600: i/o error during system call, connection reset peer javax.net.ssl.sslexception: write error: ssl=0xb4bb3600: i/o error during system call, connection reset peer @ com.android.org.conscrypt.nativecrypto.ssl_write(native method) @ com.android.org.conscrypt.opensslsocketimpl$ssloutputstream.write(opensslsocketimpl.java:765) @ com.android.okio.okio$1.write(okio.java:70) @ com.android.okio.realbufferedsink.emitcompletesegments(realbufferedsink.java:116) @ com.android.okio.realbufferedsink.write(realbufferedsink.java:44) @ com.android.okhttp.internal.http.httpconnection$fixedlengthsink.write(httpconnection.java:291) @ com.android.okio.realbufferedsink.emitcompletesegments(realbufferedsink.java:116) @ com.android.okio.realbufferedsink$1.write(realbufferedsink.java:131) @ com.amazonaws.http.urlhttpclient.write(urlhttpclient.java:155) @ com.amazonaws.http.urlhttpclient.createconnection(urlhttpclient.java:143) @ com.amazonaws.http.urlhttpclient.execute(urlhttpclient.java:60) @ com.amazonaws.http.amazonhttpclient.executehelper(amazonhttpclient.java:353) @ com.amazonaws.http.amazonhttpclient.execute(amazonhttpclient.java:196) @ com.amazonaws.services.s3.amazons3client.invoke(amazons3client.java:4234) @ com.amazonaws.services.s3.amazons3client.putobject(amazons3client.java:1644) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadcallable.uploadinonechunk(uploadcallable.java:134) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadcallable.call(uploadcallable.java:126) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadmonitor.upload(uploadmonitor.java:182) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadmonitor.call(uploadmonitor.java:140) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadmonitor.call(uploadmonitor.java:54) @ java.util.concurrent.futuretask.run(futuretask.java:237) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) @ java.lang.thread.run(thread.java:818)
happens on android 4.3 , 4.4
com.amazonaws.services.s3.model.amazons3exception: there headers present in request not signed (service: amazon s3; status code: 403; error code: accessdenied; request id: 06caf94adefe242e), s3 extended request id: oumiu+15fshpnt9uz95t3drj+gea3gi1c+rj34bhcsczbih2ypoek9yvilncxbxt
amazon sdk uses it's own client , should configured box.
what reason beahaviour?
there bug in sdk headers aren't signed. affect s3 in regions, e.g. frankfurt (eu-central-1) , china (cn-north-1), sigv4 required.
aws sdk android v2.2.2 out http://aws.amazon.com/releasenotes/4067314458888112. release addresses sigv4 signing issue s3. check out @ http://aws.amazon.com/mobile/sdk/.
Comments
Post a Comment