Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/src/main/java/io/undertow/UndertowOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ public class UndertowOptions {
*/
public static final Option<String> URL_CHARSET = Option.simple(UndertowOptions.class, "URL_CHARSET", String.class);

/**
* Default value of {@link #ALWAYS_SET_KEEP_ALIVE} option.
*/
public static final boolean DEFAULT_ALWAYS_SET_KEEP_ALIVE = true;

/**
* If this is true then a Connection: keep-alive header will be added to responses, even when it is not strictly required by
* the specification.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static StreamSinkConduit createSinkConduit(final HttpServerExchange exchange) {
if (HttpString.tryFromString(connection).equals(Headers.CLOSE)) {
exchange.setPersistent(false);
}
} else if (exchange.getConnection().getUndertowOptions().get(UndertowOptions.ALWAYS_SET_KEEP_ALIVE, true)) {
} else if (exchange.getConnection().getUndertowOptions().get(UndertowOptions.ALWAYS_SET_KEEP_ALIVE, UndertowOptions.DEFAULT_ALWAYS_SET_KEEP_ALIVE)) {
responseHeaders.put(Headers.CONNECTION, Headers.KEEP_ALIVE.toString());
}
//according to the HTTP RFC we should ignore content length if a transfer coding is specified
Expand Down
Loading