GeezerVison is showing github.com — Add RFC 10008 QUERY Method support (#16966) · netty/netty@8a5d665
File treeExpand file treeCollapse file tree Open diff view settings main/java/io/netty/handler/codec/http test/java/io/netty/handler/codec/http
microbench/src/main/java/io/netty/handler/codec/http
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaderNames.java +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -49,6 +49,10 @@ public final class HttpHeaderNames { | 49 | 49 | * {@code "accept-patch"} | 50 | 50 | */ | 51 | 51 | public static final AsciiString ACCEPT_PATCH = AsciiString.cached("accept-patch"); | | 52 | + /** | | 53 | + * {@code "accept-query"} | | 54 | + */ | | 55 | + public static final AsciiString ACCEPT_QUERY = AsciiString.cached("accept-query"); | 52 | 56 | /** | 53 | 57 | * {@code "access-control-allow-credentials"} | 54 | 58 | */ | |
Collapse file Copy file name to clipboardExpand all lines: codec-http/src/main/java/io/netty/handler/codec/http/HttpMethod.java +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -85,6 +85,12 @@ public class HttpMethod implements Comparable<HttpMethod> { | 85 | 85 | */ | 86 | 86 | public static final HttpMethod CONNECT = new HttpMethod(AsciiString.cached("CONNECT")); | 87 | 87 |
| | 88 | + /** | | 89 | + * The QUERY method requests that the request target process the enclosed content in a safe and | | 90 | + * idempotent manner and then respond with the result of that processing. | | 91 | + */ | | 92 | + public static final HttpMethod QUERY = new HttpMethod(AsciiString.cached("QUERY")); | | 93 | + | 88 | 94 | /** | 89 | 95 | * Returns the {@link HttpMethod} represented by the specified name. | 90 | 96 | * If the specified name is a standard HTTP method name, a cached instance | @@ -101,6 +107,7 @@ public static HttpMethod valueOf(String name) { | 101 | 107 | case "DELETE": return HttpMethod.DELETE; | 102 | 108 | case "TRACE": return HttpMethod.TRACE; | 103 | 109 | case "CONNECT": return HttpMethod.CONNECT; | | 110 | + case "QUERY": return HttpMethod.QUERY; | 104 | 111 | default: return new HttpMethod(name); | 105 | 112 | } | 106 | 113 | } | |
Collapse file Copy file name to clipboardExpand all lines: codec-http/src/test/java/io/netty/handler/codec/http/HttpHeaderValidationUtilTest.java +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,6 +50,7 @@ public static List<Arguments> connectionRelatedHeaders() { | 50 | 50 | list.add(header(false, HttpHeaderNames.ACCEPT_LANGUAGE)); | 51 | 51 | list.add(header(false, HttpHeaderNames.ACCEPT_RANGES)); | 52 | 52 | list.add(header(false, HttpHeaderNames.ACCEPT_PATCH)); | | 53 | + list.add(header(false, HttpHeaderNames.ACCEPT_QUERY)); | 53 | 54 | list.add(header(false, HttpHeaderNames.ACCESS_CONTROL_ALLOW_CREDENTIALS)); | 54 | 55 | list.add(header(false, HttpHeaderNames.ACCESS_CONTROL_ALLOW_HEADERS)); | 55 | 56 | list.add(header(false, HttpHeaderNames.ACCESS_CONTROL_ALLOW_METHODS)); | |
Collapse file Copy file name to clipboardExpand all lines: codec-http/src/test/java/io/netty/handler/codec/http/HttpMethodTest.java +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,6 +37,7 @@ public class HttpMethodTest { | 37 | 37 | public void valueOfReturnsCachedInstanceForKnownMethods() { | 38 | 38 | assertSame(HttpMethod.GET, HttpMethod.valueOf("GET")); | 39 | 39 | assertSame(HttpMethod.POST, HttpMethod.valueOf("POST")); | | 40 | + assertSame(HttpMethod.QUERY, HttpMethod.valueOf("QUERY")); | 40 | 41 | } | 41 | 42 |
| 42 | 43 | @Test | |
Collapse file Copy file name to clipboardExpand all lines: microbench/src/main/java/io/netty/handler/codec/http/HttpMethodMapBenchmark.java +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 37 | 37 | import static io.netty.handler.codec.http.HttpMethod.POST; | 38 | 38 | import static io.netty.handler.codec.http.HttpMethod.PUT; | 39 | 39 | import static io.netty.handler.codec.http.HttpMethod.TRACE; | | 40 | +import static io.netty.handler.codec.http.HttpMethod.QUERY; | 40 | 41 | import static io.netty.util.internal.MathUtil.findNextPositivePowerOfTwo; | 41 | 42 |
| 42 | 43 | @State(Scope.Benchmark) | @@ -61,6 +62,7 @@ public class HttpMethodMapBenchmark extends AbstractMicrobenchmark { | 61 | 62 | "POST", | 62 | 63 | "PUT", | 63 | 64 | "PATCH", | | 65 | + "QUERY", | 64 | 66 | "DELETE", | 65 | 67 | "TRACE", | 66 | 68 | "CONNECT" | @@ -98,6 +100,7 @@ public class HttpMethodMapBenchmark extends AbstractMicrobenchmark { | 98 | 100 | OLD_MAP.put(DELETE.toString(), DELETE); | 99 | 101 | OLD_MAP.put(TRACE.toString(), TRACE); | 100 | 102 | OLD_MAP.put(CONNECT.toString(), CONNECT); | | 103 | + OLD_MAP.put(QUERY.toString(), QUERY); | 101 | 104 |
| 102 | 105 | NEW_MAP = new SimpleStringMap<HttpMethod>( | 103 | 106 | new SimpleStringMap.Node<HttpMethod>(OPTIONS.toString(), OPTIONS), | @@ -106,6 +109,7 @@ public class HttpMethodMapBenchmark extends AbstractMicrobenchmark { | 106 | 109 | new SimpleStringMap.Node<HttpMethod>(POST.toString(), POST), | 107 | 110 | new SimpleStringMap.Node<HttpMethod>(PUT.toString(), PUT), | 108 | 111 | new SimpleStringMap.Node<HttpMethod>(PATCH.toString(), PATCH), | | 112 | + new SimpleStringMap.Node<HttpMethod>(QUERY.toString(), QUERY), | 109 | 113 | new SimpleStringMap.Node<HttpMethod>(DELETE.toString(), DELETE), | 110 | 114 | new SimpleStringMap.Node<HttpMethod>(TRACE.toString(), TRACE), | 111 | 115 | new SimpleStringMap.Node<HttpMethod>(CONNECT.toString(), CONNECT)); | |
|