Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Added public getter method in `SourceFieldMapper` to return excluded field ([#20205](https://github.com/opensearch-project/OpenSearch/pull/20205))
- Relax jar hell check when extended plugins share transitive dependencies ([#20103](https://github.com/opensearch-project/OpenSearch/pull/20103))
- Added public getter method in `SourceFieldMapper` to return included field ([#20290](https://github.com/opensearch-project/OpenSearch/pull/20290))
- Support for HTTP/3 (server side) ([#20017](https://github.com/opensearch-project/OpenSearch/pull/20017))

### Changed
- Handle custom metadata files in subdirectory-store ([#20157](https://github.com/opensearch-project/OpenSearch/pull/20157))
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ netty-codec-dns = { group = "io.netty", name = "netty-codec-dns", version.ref =
netty-codec-http = { group = "io.netty", name = "netty-codec-http", version.ref = "netty" }
netty-codec-http2 = { group = "io.netty", name = "netty-codec-http2", version.ref = "netty" }
netty-codec-http3 = { group = "io.netty", name = "netty-codec-http3", version.ref = "netty" }
netty-codec-native-quic = { group = "io.netty", name = "netty-codec-native-quic", version.ref = "netty" }
netty-codec-classes-quic = { group = "io.netty", name = "netty-codec-classes-quic", version.ref = "netty" }
netty-common = { group = "io.netty", name = "netty-common", version.ref = "netty" }
netty-handler = { group = "io.netty", name = "netty-handler", version.ref = "netty" }
Expand Down
15 changes: 14 additions & 1 deletion modules/transport-netty4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,25 @@ dependencies {
api "io.netty:netty-codec:${versions.netty}"
api "io.netty:netty-codec-http:${versions.netty}"
api "io.netty:netty-codec-http2:${versions.netty}"
api "io.netty:netty-codec-http3:${versions.netty}"
api "io.netty:netty-codec-classes-quic:${versions.netty}"
api "io.netty:netty-codec-native-quic:${versions.netty}"
api "io.netty:netty-common:${versions.netty}"
api "io.netty:netty-handler:${versions.netty}"
api "io.netty:netty-resolver:${versions.netty}"
api "io.netty:netty-transport:${versions.netty}"
api "io.netty:netty-transport-native-unix-common:${versions.netty}"

testFipsRuntimeOnly "org.bouncycastle:bc-fips:${versions.bouncycastle_jce}"
testFipsRuntimeOnly "org.bouncycastle:bctls-fips:${versions.bouncycastle_tls}"
testFipsRuntimeOnly "org.bouncycastle:bcutil-fips:${versions.bouncycastle_util}"

// Bundle all supported OSes and Archs
runtimeOnly "io.netty:netty-codec-native-quic:${versions.netty}:linux-x86_64"
runtimeOnly "io.netty:netty-codec-native-quic:${versions.netty}:linux-aarch_64"
runtimeOnly "io.netty:netty-codec-native-quic:${versions.netty}:osx-x86_64"
runtimeOnly "io.netty:netty-codec-native-quic:${versions.netty}:osx-aarch_64"
runtimeOnly "io.netty:netty-codec-native-quic:${versions.netty}:windows-x86_64"
}

restResources {
Expand Down Expand Up @@ -205,7 +216,9 @@ thirdPartyAudit {

'io.netty.pkitesting.CertificateBuilder',
'io.netty.pkitesting.CertificateBuilder$Algorithm',
'io.netty.pkitesting.X509Bundle'
'io.netty.pkitesting.X509Bundle',

'io.netty.channel.epoll.SegmentedDatagramPacket'
)

ignoreViolations(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8b441d8465077c1ac1ed57bad3f087bc2a84e994
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e8a593762196738c0265259e5728a275e2d8f1ea
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
87ce82aa487b3701a83312b748d2d311b58bbe68
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3f0ab9d43f00c8a02ba22702aff482f598863642
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7725db063980a53420afbced5fb39dbd0eebbd8a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
53eee547f8731254084274d31b82171c51d509fa
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6873dd577760b80b345fa5ab7dfe589ed9c1bbc3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
97fda97b8df8f3e8fefa50336e108756b76f8b77
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.http.netty4;

import org.opensearch.common.lifecycle.AbstractLifecycleComponent;
import org.opensearch.common.util.io.IOUtils;
import org.opensearch.core.common.transport.BoundTransportAddress;
import org.opensearch.http.AbstractHttpServerTransport;
import org.opensearch.http.HttpInfo;
import org.opensearch.http.HttpServerTransport;
import org.opensearch.http.HttpStats;

import java.io.IOException;

public class Netty4CompositeHttpServerTransport extends AbstractLifecycleComponent implements HttpServerTransport {
private final AbstractHttpServerTransport[] transports;

public Netty4CompositeHttpServerTransport(AbstractHttpServerTransport... transports) {
if (transports == null || transports.length == 0) {
throw new IllegalArgumentException("At least one transport must be provided");
}

this.transports = transports;
}

@Override
public BoundTransportAddress boundAddress() {
return transports[0].boundAddress(); /* both transports bind to the same port but different protocol */
}

@Override
public HttpInfo info() {
return transports[0].info();
}

@Override
public HttpStats stats() {
long serverOpen = 0L, totalOpen = 0L;

for (AbstractHttpServerTransport transport : transports) {
final HttpStats stats = transport.stats();
serverOpen += stats.getServerOpen();
totalOpen += stats.getTotalOpen();
}

return new HttpStats.Builder().serverOpen(serverOpen).totalOpen(totalOpen).build();
}

@Override
protected void doStart() {
for (AbstractHttpServerTransport transport : transports) {
transport.start();
}
}

@Override
protected void doStop() {
for (AbstractHttpServerTransport transport : transports) {
transport.stop();
}
}

@Override
protected void doClose() throws IOException {
for (AbstractHttpServerTransport transport : transports) {
IOUtils.closeWhileHandlingException(transport);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

package org.opensearch.http.netty4;

import org.opensearch.ExceptionsHelper;
import org.opensearch.core.common.unit.ByteSizeValue;

import java.util.List;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.TooLongHttpLineException;

@ChannelHandler.Sharable
class Netty4Http3RequestCreator extends MessageToMessageDecoder<FullHttpRequest> {
private final ByteSizeValue maxInitialLineLength;

Netty4Http3RequestCreator(ByteSizeValue maxInitialLineLength) {
this.maxInitialLineLength = maxInitialLineLength;
}

@Override
protected void decode(ChannelHandlerContext ctx, FullHttpRequest msg, List<Object> out) {
if (msg.decoderResult().isFailure()) {
final Throwable cause = msg.decoderResult().cause();
final Exception nonError;
if (cause instanceof Error) {
ExceptionsHelper.maybeDieOnAnotherThread(cause);
nonError = new Exception(cause);
} else {
nonError = (Exception) cause;
}
out.add(new Netty4HttpRequest(msg.retain(), nonError));
} else {
// The HTTP/3 implementation in Netty does not validate Request URI length, manually
// applying the validation rules here.
if (msg.uri().length() > maxInitialLineLength.bytesAsInt()) {
out.add(
new Netty4HttpRequest(
msg.retain(),
new TooLongHttpLineException("An HTTP line is larger than " + maxInitialLineLength.bytesAsInt() + " bytes.")
)
);
} else {
out.add(new Netty4HttpRequest(msg.retain()));
}
}
}
}
Loading
Loading