Skip to content

Commit 5ed6f85

Browse files
committed
Protocol set to 1.1
By default http2.0 was being used , which has been changed to 1.1 as web server behaved incorrectly when HTTP/2 is enabled
1 parent 7d8919e commit 5ed6f85

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

api/src/main/java/io/minio/MinioClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
import okhttp3.RequestBody;
6969
import okhttp3.Response;
7070
import okhttp3.ResponseBody;
71+
import okhttp3.Protocol;
7172

7273
import org.joda.time.DateTime;
7374
import org.xmlpull.v1.XmlPullParser;
@@ -655,11 +656,14 @@ public MinioClient(String endpoint, int port, String accessKey, String secretKey
655656
if (httpClient != null) {
656657
this.httpClient = httpClient;
657658
} else {
659+
List<Protocol> protocol = new LinkedList<>();
660+
protocol.add(Protocol.HTTP_1_1);
658661
this.httpClient = new OkHttpClient();
659662
this.httpClient = this.httpClient.newBuilder()
660663
.connectTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
661664
.writeTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
662665
.readTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
666+
.protocols(protocol)
663667
.build();
664668
}
665669

functional/FunctionalTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,14 +1196,11 @@ public static void getObject_test7() throws Exception {
11961196
}
11971197

11981198
InputStream stream = client.getObject(bucketName, objectName, sse);
1199-
byte[] getbyteArray = new byte[stream.available()];
1199+
byte[] getbyteArray = new byte[stream.available()];
12001200
int bytes_read_get = stream.read(getbyteArray);
12011201
String getString = new String(getbyteArray, StandardCharsets.UTF_8);
12021202
stream.close();
12031203

1204-
// client.getObject(bucketName, objectName, sse)
1205-
// .close();
1206-
12071204
// Compare if contents received are same as the initial uploaded object.
12081205
if ((!putString.equals(getString)) || (bytes_read_put != bytes_read_get)) {
12091206
throw new Exception("Contents received from getObject doesn't match initial contents.");

0 commit comments

Comments
 (0)