]> git.kaiwu.me - nginx.git/commit
gRPC: generate error when response size is wrong.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 6 Jul 2020 15:36:25 +0000 (18:36 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 6 Jul 2020 15:36:25 +0000 (18:36 +0300)
commit5348706fe607c2b6704b52078cba77ee8fa298b8
tree3ce006ebe127483bd7da99831eff78c9a714d340
parent1194ba36a0685efb0818d28dad5ef518949c910b
gRPC: generate error when response size is wrong.

As long as the "Content-Length" header is given, we now make sure
it exactly matches the size of the response.  If it doesn't,
the response is considered malformed and must not be forwarded
(https://tools.ietf.org/html/rfc7540#section-8.1.2.6).  While it
is not really possible to "not forward" the response which is already
being forwarded, we generate an error instead, which is the closest
equivalent.

Previous behaviour was to pass everything to the client, but this
seems to be suboptimal and causes issues (ticket #1695).  Also this
directly contradicts HTTP/2 specification requirements.

Note that the new behaviour for the gRPC proxy is more strict than that
applied in other variants of proxying.  This is intentional, as HTTP/2
specification requires us to do so, while in other types of proxying
malformed responses from backends are well known and historically
tolerated.
src/http/modules/ngx_http_grpc_module.c