Skip to content

Commit

Permalink
allow custom Content-Length for HEAD method
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterRK committed Mar 2, 2023
1 parent e028535 commit 65e4bd2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -105,7 +105,7 @@ public synchronized OutputStream writeResponseStatusAndHeaders(long contentLengt

if (contentLength == -1) {
HttpUtil.setTransferEncodingChunked(response, true);
} else {
} else if (req.method() != HttpMethod.HEAD || !response.headers().contains(HttpHeaderNames.CONTENT_LENGTH)) {
response.headers().set(HttpHeaderNames.CONTENT_LENGTH, contentLength);
}

Expand Down

0 comments on commit 65e4bd2

Please sign in to comment.