Skip to content

Commit 859a564

Browse files
authored
Revert "proxy httpclient does not release connection pool when frontend close…" (#97)
This reverts commit 32381a3.
1 parent 9264b6d commit 859a564

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/main/java/io/vertx/httpproxy/impl/ProxiedRequest.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
import io.vertx.core.http.*;
1616
import io.vertx.core.internal.ContextInternal;
1717
import io.vertx.core.internal.http.HttpServerRequestInternal;
18-
import io.vertx.core.internal.logging.Logger;
19-
import io.vertx.core.internal.logging.LoggerFactory;
2018
import io.vertx.core.net.HostAndPort;
2119
import io.vertx.core.streams.Pipe;
2220
import io.vertx.httpproxy.Body;
@@ -27,7 +25,6 @@
2725
import java.util.Objects;
2826

2927
public class ProxiedRequest implements ProxyRequest {
30-
private final static Logger log = LoggerFactory.getLogger(ProxiedRequest.class);
3128

3229
private static final CharSequence X_FORWARDED_HOST = HttpHeaders.createOptimized("x-forwarded-host");
3330

@@ -150,14 +147,6 @@ public ProxyResponse response() {
150147
}
151148

152149
void sendRequest(Handler<AsyncResult<ProxyResponse>> responseHandler) {
153-
proxiedRequest.connection().closeHandler(unused -> {
154-
if (log.isTraceEnabled()) {
155-
log.trace("Frontend connection closed,uri: " + proxiedRequest.uri());
156-
}
157-
158-
request.reset();
159-
proxiedRequest.response().reset();
160-
});
161150

162151
request.response().<ProxyResponse>map(r -> {
163152
r.pause(); // Pause it

src/test/java/io/vertx/tests/ProxyClientKeepAliveTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public void testFrontendCloseResponse(TestContext ctx) {
266266

267267
@Test
268268
public void testFrontendCloseChunkedResponse(TestContext ctx) {
269-
testFrontendCloseResponse(ctx, true);
269+
testBackendCloseResponse(ctx, true);
270270
}
271271

272272
private void testFrontendCloseResponse(TestContext ctx, boolean chunked) {
@@ -279,11 +279,13 @@ private void testFrontendCloseResponse(TestContext ctx, boolean chunked) {
279279
resp.putHeader("content-length", "10000");
280280
}
281281
resp.write("part");
282-
resp.closeHandler(unused -> async.complete());
282+
resp.exceptionHandler(err -> {
283+
async.complete();
284+
});
283285
});
284286
startProxy(backend);
285287
client = vertx.createHttpClient();
286-
client.request(GET, 8080, "localhost", "/").onComplete(ctx.asyncAssertSuccess(req -> {
288+
client.request(GET, 8081, "localhost", "/").onComplete(ctx.asyncAssertSuccess(req -> {
287289
req.send().onComplete(ctx.asyncAssertSuccess(resp -> {
288290
resp.handler(buff -> {
289291
resp.request().connection().close();

0 commit comments

Comments
 (0)