Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http request error in android 4.3 and android 5.0.2 but working on android 2.3 #59

Closed
rdiaz82 opened this issue Sep 22, 2015 · 5 comments
Labels
question General question

Comments

@rdiaz82
Copy link

rdiaz82 commented Sep 22, 2015

Hi
I have downloaded the sample app and I tried to upload images to a S3 bucket. In android 2.3 all works perfect but in android 4.3 and android 5.0.2 I'm getting the following error:

I/AmazonHttpClient﹕ Unable to execute HTTP request: Hostname 'here_goes_my_bucket_name_changed_for_this_post.s3.amazonaws.com' was not verified
    java.io.IOException: Hostname 'here_goes_my_bucket_name_changed_for_this_post.s3.amazonaws.com' was not verified
            at libcore.net.http.HttpConnection.verifySecureSocketHostname(HttpConnection.java:223)
            at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:446)
            at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290)
            at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240)
            at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81)
            at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197)
            at libcore.net.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:281)
            at com.amazonaws.http.UrlHttpClient.writeContentToConnection(UrlHttpClient.java:128)
            at com.amazonaws.http.UrlHttpClient.execute(UrlHttpClient.java:65)
            at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:353)
            at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:196)
            at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4230)
            at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1644)
            at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.uploadSinglePartAndWaitForCompletion(UploadTask.java:174)
            at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.call(UploadTask.java:74)
            at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.call(UploadTask.java:40)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)

I suppose that is something related with https connection but I don't really know if is something related with my S3 configuration or is directly related with the app. The most strange thing is that the upload works like a charm in android 2.3 but not in newer android versions.

Thanks in advance :)

PS: I have raised the issue in the sample app repo as well but at the end is a library issue more than sample app issue. https://github.com/awslabs/aws-sdk-android-samples/issues/31

@fosterzhang
Copy link
Contributor

What version of AWS Android SDK are you using? What is your bucket? Does it have special characters like ._-/?

@fosterzhang fosterzhang added the question General question label Sep 22, 2015
@rdiaz82
Copy link
Author

rdiaz82 commented Sep 22, 2015

Hi!

Thanks for your quick response. I'm using the version 2.2.6 of AWS android SDK and you are right my bucket includes "." in the name. is the problem related with that?

Thanks.

@rdiaz82
Copy link
Author

rdiaz82 commented Sep 22, 2015

Hi!,

I have tried and used another bucket without any strange symbol in the name and all works like a charm 👍

@fosterzhang
Copy link
Contributor

Usually not a problem, but there is an issue with the SDK of handling Virtual Hosting of Buckets with special characters. A dot in the bucket can cause hostname verification failure. We'll address it ASAP.

A work around is to turn on path style access in S3ClientOptions.

@wdane
Copy link
Contributor

wdane commented Oct 14, 2015

@wdane wdane closed this as completed Oct 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question
Projects
None yet
Development

No branches or pull requests

3 participants