Browse Source

Merge branch '3.4.x'

Closes gh-45035
pull/45049/head
Moritz Halbritter 10 months ago
parent
commit
5c32890f43
  1. 5
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/HttpClientTransport.java
  2. 8
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java

5
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/HttpClientTransport.java

@ -35,6 +35,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse; @@ -35,6 +35,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.io.entity.AbstractHttpEntity;
import org.springframework.boot.buildpack.platform.io.Content;
@ -156,6 +157,7 @@ abstract class HttpClientTransport implements HttpTransport { @@ -156,6 +157,7 @@ abstract class HttpClientTransport implements HttpTransport {
private Response execute(HttpUriRequest request) {
try {
beforeExecute(request);
ClassicHttpResponse response = this.client.executeOpen(this.host, request, null);
int statusCode = response.getCode();
if (statusCode >= 400 && statusCode <= 500) {
@ -173,6 +175,9 @@ abstract class HttpClientTransport implements HttpTransport { @@ -173,6 +175,9 @@ abstract class HttpClientTransport implements HttpTransport {
}
}
protected void beforeExecute(HttpRequest request) {
}
private byte[] readContent(ClassicHttpResponse response) throws IOException {
HttpEntity entity = response.getEntity();
if (entity == null) {

8
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,6 +35,7 @@ import org.apache.hc.client5.http.io.HttpClientConnectionManager; @@ -35,6 +35,7 @@ import org.apache.hc.client5.http.io.HttpClientConnectionManager;
import org.apache.hc.client5.http.routing.HttpRoutePlanner;
import org.apache.hc.client5.http.ssl.TlsSocketStrategy;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.config.Lookup;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.TimeValue;
@ -62,6 +63,11 @@ final class LocalHttpClientTransport extends HttpClientTransport { @@ -62,6 +63,11 @@ final class LocalHttpClientTransport extends HttpClientTransport {
super(client, host);
}
@Override
protected void beforeExecute(HttpRequest request) {
request.setHeader("Host", LOCAL_DOCKER_HOST.toHostString());
}
static LocalHttpClientTransport create(ResolvedDockerHost dockerHost) {
HttpClientBuilder builder = HttpClients.custom()
.setConnectionManager(new LocalConnectionManager(dockerHost))

Loading…
Cancel
Save