Skip to content

Commit

Permalink
Fix jdk8 incompaitable changes
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Nov 10, 2023
1 parent f12a66b commit b06ce7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.opensearch.http.netty4.Netty4HttpChannel;
import org.opensearch.rest.RestRequest.Method;

import com.google.common.collect.ImmutableList;

import io.netty.handler.codec.http.HttpRequest;
import org.opensearch.rest.RestUtils;

Expand All @@ -44,7 +46,7 @@ public class NettyRequest implements SecurityRequest {
@Override
public Map<String, List<String>> getHeaders() {
final Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
underlyingRequest.headers().forEach(h -> headers.put(h.getKey(), List.of(h.getValue())));
underlyingRequest.headers().forEach(h -> headers.put(h.getKey(), ImmutableList.of(h.getValue())));
return headers;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ public void channelRead0(ChannelHandlerContext ctx, DefaultHttpRequest msg) thro

requestChannel.getQueuedResponse().ifPresent(response -> ctx.channel().attr(EARLY_RESPONSE).set(response));

boolean shouldDecompress = !shouldSkipAuthentication && requestChannel.getQueuedResponse().isEmpty();
boolean shouldDecompress = !shouldSkipAuthentication && !(requestChannel.getQueuedResponse().isPresent());

if (requestChannel.getQueuedResponse().isEmpty() || shouldSkipAuthentication) {
if (!(requestChannel.getQueuedResponse().isPresent()) || shouldSkipAuthentication) {
// Only allow decompression on authenticated requests that also aren't one of those ^
ctx.channel().attr(SHOULD_DECOMPRESS).set(Boolean.valueOf(shouldDecompress));
ctx.channel().attr(IS_AUTHENTICATED).set(Boolean.TRUE);
Expand Down

0 comments on commit b06ce7b

Please sign in to comment.