From 533b32f1b390a3a88ec2008d0561e07c926d879a Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Thu, 30 Sep 2021 02:46:20 +0000 Subject: [PATCH] grpc_json: support unescape '+' in query parameters to space. (#18226) To fix: #13965 grpc_json envoy filter adds a new field 'query_param_unescape_plus` to enable the support of converting "+" to space in query parameters. The actual unescape code is implemented in grpc-httpjson-transcoding. Risk Level: None Testing: integration tests Docs Changes: None Release Notes: Yes Signed-off-by: Wayne Zhang Mirrored from https://github.com/envoyproxy/envoy @ 1ba355b5e9f00cda595d5b52e3390d473fa5ecce --- envoy/config/route/v3/route_components.proto | 8 ++++++++ .../filters/http/grpc_json_transcoder/v3/transcoder.proto | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/envoy/config/route/v3/route_components.proto b/envoy/config/route/v3/route_components.proto index ec27e627..d25edd75 100644 --- a/envoy/config/route/v3/route_components.proto +++ b/envoy/config/route/v3/route_components.proto @@ -529,6 +529,14 @@ message RouteMatch { // against all the specified query parameters. If the number of specified // query parameters is nonzero, they all must match the *path* header's // query string for a match to occur. + // + // .. note:: + // + // If query parameters are used to pass request message fields when + // `grpc_json_transcoder `_ + // is used, the transcoded message fields maybe different. The query parameters are + // url encoded, but the message fields are not. For example, if a query + // parameter is "foo%20bar", the message field will be "foo bar". repeated QueryParameterMatcher query_parameters = 7; // If specified, only gRPC requests will be matched. The router will check diff --git a/envoy/extensions/filters/http/grpc_json_transcoder/v3/transcoder.proto b/envoy/extensions/filters/http/grpc_json_transcoder/v3/transcoder.proto index a4feeff3..7311abe8 100644 --- a/envoy/extensions/filters/http/grpc_json_transcoder/v3/transcoder.proto +++ b/envoy/extensions/filters/http/grpc_json_transcoder/v3/transcoder.proto @@ -15,7 +15,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE; // gRPC-JSON transcoder :ref:`configuration overview `. // [#extension: envoy.filters.http.grpc_json_transcoder] -// [#next-free-field: 12] +// [#next-free-field: 13] // GrpcJsonTranscoder filter configuration. // The filter itself can be used per route / per virtual host or on the general level. The most // specific one is being used for a given route. If the list of services is empty - filter @@ -211,12 +211,16 @@ message GrpcJsonTranscoder { bool convert_grpc_status = 9; // URL unescaping policy. - // This spec is only applied when extracting variable with multiple segments. + // This spec is only applied when extracting variable with multiple segments in the URL path. // For example, in case of `/foo/{x=*}/bar/{y=prefix/*}/{z=**}` `x` variable is single segment and `y` and `z` are multiple segments. // For a path with `/foo/first/bar/prefix/second/third/fourth`, `x=first`, `y=prefix/second`, `z=third/fourth`. // If this setting is not specified, the value defaults to :ref:`ALL_CHARACTERS_EXCEPT_RESERVED`. UrlUnescapeSpec url_unescape_spec = 10 [(validate.rules).enum = {defined_only: true}]; + // If true, unescape '+' to space when extracting variables in query parameters. + // This is to support `HTML 2.0 `_ + bool query_param_unescape_plus = 12; + // Configure the behavior when handling requests that cannot be transcoded. // // By default, the transcoder will silently pass through HTTP requests that are malformed.