diff --git a/CHANGELOG.md b/CHANGELOG.md index db0d2f826ca..4489df3c4e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * Fix #4931: using coarse grain locking for all mock server operations * Fix #4947: typo in HttpClient.Factory scoring system logic * Fix #4928: allows non-okhttp clients to handle invalid status +* Fix #4954: disabling expect continue support by default in the jdk client #### Improvements * Fix #4675: adding a fully client side timeout for informer watches diff --git a/httpclient-jdk/src/main/java/io/fabric8/kubernetes/client/jdkhttp/JdkHttpClientFactory.java b/httpclient-jdk/src/main/java/io/fabric8/kubernetes/client/jdkhttp/JdkHttpClientFactory.java index 685a28f6dba..36d7f347982 100644 --- a/httpclient-jdk/src/main/java/io/fabric8/kubernetes/client/jdkhttp/JdkHttpClientFactory.java +++ b/httpclient-jdk/src/main/java/io/fabric8/kubernetes/client/jdkhttp/JdkHttpClientFactory.java @@ -80,4 +80,16 @@ protected void closeHttpClient(JdkHttpClientImpl jdkHttpClientImpl) { .map(ShutdownableExecutor.class::cast).ifPresent(ShutdownableExecutor::shutdownNow); } + /** + * Due to go/kubernetes bug https://github.com/golang/go/issues/57824 + * expect continue is not supported for jdk. Override this method if you are using a + * kubernetes version with the fix and require this support (currently only used for + * submitting openshift builds) + * + * @return + */ + protected boolean useExpectContinue() { + return false; + } + } diff --git a/httpclient-jdk/src/main/java/io/fabric8/kubernetes/client/jdkhttp/JdkHttpClientImpl.java b/httpclient-jdk/src/main/java/io/fabric8/kubernetes/client/jdkhttp/JdkHttpClientImpl.java index e0d22f5b511..01e9b1c609d 100644 --- a/httpclient-jdk/src/main/java/io/fabric8/kubernetes/client/jdkhttp/JdkHttpClientImpl.java +++ b/httpclient-jdk/src/main/java/io/fabric8/kubernetes/client/jdkhttp/JdkHttpClientImpl.java @@ -296,7 +296,7 @@ public long contentLength() { } requestBuilder.uri(request.uri()); - if (request.isExpectContinue()) { + if (request.isExpectContinue() && this.builder.getClientFactory().useExpectContinue()) { requestBuilder.expectContinue(true); } return requestBuilder;