Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit 0a1f309

Browse files
committed
Don't precompute content length headers
Frameworks doing this may be considered as stripped
1 parent 4b2a2ee commit 0a1f309

2 files changed

Lines changed: 0 additions & 4 deletions

File tree

frameworks/Java/quarkus/reactive-routes-pgclient/src/main/java/io/quarkus/benchmark/resource/PlaintextResource.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
public class PlaintextResource {
1212
private static final String HELLO_WORLD = "Hello, world!";
1313
private static final Buffer HELLO_WORLD_BUFFER = Buffer.buffer(HELLO_WORLD, "UTF-8");
14-
private static final CharSequence HELLO_WORLD_LENGTH = HttpHeaders.createOptimized("" + HELLO_WORLD.length());
1514

1615
@Route(path = "plaintext")
1716
public void plaintext(final RoutingContext rc) {
1817
final var response = rc.response();
1918
final var headers = response.headers();
2019
headers.add(HttpHeaders.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN);
21-
headers.add(HttpHeaders.CONTENT_LENGTH, HELLO_WORLD_LENGTH);
2220
response.end(HELLO_WORLD_BUFFER, null);
2321
}
2422
}

frameworks/Java/quarkus/vertx/src/main/java/io/quarkus/benchmark/resource/PlaintextHttpHandler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
public class PlaintextHttpHandler {
1313
private static final String HELLO_WORLD = "Hello, world!";
1414
private static final Buffer HELLO_WORLD_BUFFER = Buffer.buffer(HELLO_WORLD, "UTF-8");
15-
private static final CharSequence HELLO_WORLD_LENGTH = HttpHeaders.createOptimized("" + HELLO_WORLD.length());
1615

1716
public void handle(final HttpServerRequest request) {
1817
final HttpServerResponse response = request.response();
1918
final MultiMap headers = response.headers();
20-
headers.add(HttpHeaders.CONTENT_LENGTH, HELLO_WORLD_LENGTH);
2119
headers.add(HttpHeaders.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN);
2220
response.end(HELLO_WORLD_BUFFER, null);
2321
}

0 commit comments

Comments
 (0)