Skip to content

Commit 0b895ef

Browse files
sinhaashishkannappanr
authored andcommitted
Protocol set to 1.1 (#766)
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 55bb87d commit 0b895ef

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;
@@ -657,11 +658,14 @@ public MinioClient(String endpoint, int port, String accessKey, String secretKey
657658
if (httpClient != null) {
658659
this.httpClient = httpClient;
659660
} else {
661+
List<Protocol> protocol = new LinkedList<>();
662+
protocol.add(Protocol.HTTP_1_1);
660663
this.httpClient = new OkHttpClient();
661664
this.httpClient = this.httpClient.newBuilder()
662665
.connectTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
663666
.writeTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
664667
.readTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
668+
.protocols(protocol)
665669
.build();
666670
}
667671

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)