diff --git a/SECURITY.md b/SECURITY.md index 6e53a683c6..81e609b638 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -62,7 +62,7 @@ In Maven, you can use the [os-maven-plugin](https://github.com/trustin/os-maven- io.netty netty-tcnative-boringssl-static - 1.1.33.Fork23 + 1.1.33.Fork25 @@ -80,7 +80,7 @@ buildscript { } dependencies { - compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork23' + compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork25' } ``` @@ -115,7 +115,7 @@ In Maven, you can use the [os-maven-plugin](https://github.com/trustin/os-maven- io.netty netty-tcnative - 1.1.33.Fork23 + 1.1.33.Fork25 ${tcnative.classifier} @@ -183,7 +183,7 @@ if (osdetector.os == "linux" && osdetector.release.isLike("fedora")) { } dependencies { - compile 'io.netty:netty-tcnative:1.1.33.Fork23:' + tcnative_classifier + compile 'io.netty:netty-tcnative:1.1.33.Fork25:' + tcnative_classifier } ``` diff --git a/benchmarks/src/jmh/java/io/grpc/netty/OutboundHeadersBenchmark.java b/benchmarks/src/jmh/java/io/grpc/netty/OutboundHeadersBenchmark.java index 46737ede04..c2bc5c23d9 100644 --- a/benchmarks/src/jmh/java/io/grpc/netty/OutboundHeadersBenchmark.java +++ b/benchmarks/src/jmh/java/io/grpc/netty/OutboundHeadersBenchmark.java @@ -111,7 +111,7 @@ public class OutboundHeadersBenchmark { scratchBuffer.clear(); Http2Headers headers = Utils.convertClientHeaders(metadata, scheme, defaultPath, authority, userAgent); - headersEncoder.encodeHeaders(headers, scratchBuffer); + headersEncoder.encodeHeaders(1, headers, scratchBuffer); return scratchBuffer; } } diff --git a/build.gradle b/build.gradle index 2b012c2b49..ee9377ea4f 100644 --- a/build.gradle +++ b/build.gradle @@ -161,9 +161,9 @@ subprojects { protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.8.0', protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}", - netty: 'io.netty:netty-codec-http2:[4.1.6.Final]', - netty_epoll: 'io.netty:netty-transport-native-epoll:4.1.6.Final' + epoll_suffix, - netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork23', + netty: 'io.netty:netty-codec-http2:[4.1.7.Final]', + netty_epoll: 'io.netty:netty-transport-native-epoll:4.1.7.Final' + epoll_suffix, + netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork25', // Test dependencies. junit: 'junit:junit:4.11', diff --git a/core/src/main/java/io/grpc/internal/GrpcUtil.java b/core/src/main/java/io/grpc/internal/GrpcUtil.java index b62f3d840a..acca2c9a9d 100644 --- a/core/src/main/java/io/grpc/internal/GrpcUtil.java +++ b/core/src/main/java/io/grpc/internal/GrpcUtil.java @@ -182,6 +182,8 @@ public final class GrpcUtil { } switch (httpStatusCode) { case HttpURLConnection.HTTP_BAD_REQUEST: // 400 + case 431: // Request Header Fields Too Large + // TODO(carl-mastrangelo): this should be added to the http-grpc-status-mapping.md doc. return Status.Code.INTERNAL; case HttpURLConnection.HTTP_UNAUTHORIZED: // 401 return Status.Code.UNAUTHENTICATED; diff --git a/netty/src/test/java/io/grpc/netty/GrpcHttp2HeadersDecoderTest.java b/netty/src/test/java/io/grpc/netty/GrpcHttp2HeadersDecoderTest.java index 7064839794..3196842457 100644 --- a/netty/src/test/java/io/grpc/netty/GrpcHttp2HeadersDecoderTest.java +++ b/netty/src/test/java/io/grpc/netty/GrpcHttp2HeadersDecoderTest.java @@ -39,7 +39,6 @@ import static org.junit.Assert.assertThat; import io.grpc.netty.GrpcHttp2HeadersDecoder.GrpcHttp2ClientHeadersDecoder; import io.grpc.netty.GrpcHttp2HeadersDecoder.GrpcHttp2ServerHeadersDecoder; - import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http2.DefaultHttp2Headers; @@ -49,8 +48,8 @@ import io.netty.handler.codec.http2.Http2Headers; import io.netty.handler.codec.http2.Http2HeadersDecoder; import io.netty.handler.codec.http2.Http2HeadersEncoder; import io.netty.handler.codec.http2.Http2HeadersEncoder.SensitivityDetector; -import io.netty.util.ReferenceCountUtil; +import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -68,6 +67,15 @@ public class GrpcHttp2HeadersDecoderTest { } }; + private ByteBuf encodedHeaders; + + @After + public void tearDown() { + if (encodedHeaders != null) { + encodedHeaders.release(); + } + } + @Test public void decode_requestHeaders() throws Http2Exception { Http2HeadersDecoder decoder = new GrpcHttp2ServerHeadersDecoder(DEFAULT_MAX_HEADER_LIST_SIZE); @@ -78,8 +86,8 @@ public class GrpcHttp2HeadersDecoderTest { headers.add(of(":scheme"), of("https")).add(of(":method"), of("GET")) .add(of(":path"), of("index.html")).add(of(":authority"), of("foo.grpc.io")) .add(of("custom"), of("header")); - ByteBuf encodedHeaders = ReferenceCountUtil.releaseLater(Unpooled.buffer()); - encoder.encodeHeaders(headers, encodedHeaders); + encodedHeaders = Unpooled.buffer(); + encoder.encodeHeaders(1 /* randomly chosen */, headers, encodedHeaders); Http2Headers decodedHeaders = decoder.decodeHeaders(3 /* randomly chosen */, encodedHeaders); assertEquals(headers.get(of(":scheme")), decodedHeaders.scheme()); @@ -105,8 +113,8 @@ public class GrpcHttp2HeadersDecoderTest { Http2Headers headers = new DefaultHttp2Headers(false); headers.add(of(":status"), of("200")).add(of("custom"), of("header")); - ByteBuf encodedHeaders = ReferenceCountUtil.releaseLater(Unpooled.buffer()); - encoder.encodeHeaders(headers, encodedHeaders); + encodedHeaders = Unpooled.buffer(); + encoder.encodeHeaders(1 /* randomly chosen */, headers, encodedHeaders); Http2Headers decodedHeaders = decoder.decodeHeaders(3 /* randomly chosen */, encodedHeaders); assertEquals(headers.get(of(":status")), decodedHeaders.get(of(":status"))); @@ -124,8 +132,8 @@ public class GrpcHttp2HeadersDecoderTest { Http2HeadersEncoder encoder = new DefaultHttp2HeadersEncoder(NEVER_SENSITIVE); - ByteBuf encodedHeaders = ReferenceCountUtil.releaseLater(Unpooled.buffer()); - encoder.encodeHeaders(new DefaultHttp2Headers(false), encodedHeaders); + ByteBuf encodedHeaders = Unpooled.buffer(); + encoder.encodeHeaders(1 /* randomly chosen */, new DefaultHttp2Headers(false), encodedHeaders); Http2Headers decodedHeaders = decoder.decodeHeaders(3 /* randomly chosen */, encodedHeaders); assertEquals(0, decodedHeaders.size()); diff --git a/netty/src/test/java/io/grpc/netty/NettyClientTransportTest.java b/netty/src/test/java/io/grpc/netty/NettyClientTransportTest.java index 82268cfd01..da343a0be8 100644 --- a/netty/src/test/java/io/grpc/netty/NettyClientTransportTest.java +++ b/netty/src/test/java/io/grpc/netty/NettyClientTransportTest.java @@ -313,8 +313,8 @@ public class NettyClientTransportTest { + " size limit!"); } catch (Exception e) { Throwable rootCause = getRootCause(e); - assertTrue(rootCause instanceof StatusException); - assertEquals(Status.INTERNAL.getCode(), ((StatusException) rootCause).getStatus().getCode()); + Status status = ((StatusException) rootCause).getStatus(); + assertEquals(status.toString(), Status.Code.INTERNAL, status.getCode()); } }