diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2020-05-26 20:26:44 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2020-05-26 20:26:44 +0300 |
commit | 38091071a8ebef605433aef4b8c0a5b55845b43f (patch) | |
tree | e90b9a87999acd121234d156047c54f0d403aa5f /src/http/modules/ngx_http_grpc_module.c | |
parent | 2360f58a9b4515cfb5aa2d454892da70274ae183 (diff) | |
parent | bab7ab047757c5e9e15fbd70880e2a3d27c75372 (diff) | |
download | nginx-38091071a8ebef605433aef4b8c0a5b55845b43f.tar.gz nginx-38091071a8ebef605433aef4b8c0a5b55845b43f.zip |
Merged with the default branch.
Diffstat (limited to 'src/http/modules/ngx_http_grpc_module.c')
-rw-r--r-- | src/http/modules/ngx_http_grpc_module.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c index d4af66dbf..992211e73 100644 --- a/src/http/modules/ngx_http_grpc_module.c +++ b/src/http/modules/ngx_http_grpc_module.c @@ -120,6 +120,7 @@ typedef struct { unsigned end_stream:1; unsigned done:1; unsigned status:1; + unsigned rst:1; ngx_http_request_t *request; @@ -1205,6 +1206,7 @@ ngx_http_grpc_reinit_request(ngx_http_request_t *r) ctx->end_stream = 0; ctx->done = 0; ctx->status = 0; + ctx->rst = 0; ctx->connection = NULL; return NGX_OK; @@ -2088,7 +2090,10 @@ ngx_http_grpc_filter(void *data, ssize_t bytes) return NGX_ERROR; } - if (ctx->stream_id && ctx->done) { + if (ctx->stream_id && ctx->done + && ctx->type != NGX_HTTP_V2_RST_STREAM_FRAME + && ctx->type != NGX_HTTP_V2_WINDOW_UPDATE_FRAME) + { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent frame for closed stream %ui", ctx->stream_id); @@ -2131,11 +2136,21 @@ ngx_http_grpc_filter(void *data, ssize_t bytes) return NGX_ERROR; } - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "upstream rejected request with error %ui", - ctx->error); + if (ctx->error || !ctx->done) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "upstream rejected request with error %ui", + ctx->error); + return NGX_ERROR; + } - return NGX_ERROR; + if (ctx->rst) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "upstream sent frame for closed stream %ui", + ctx->stream_id); + return NGX_ERROR; + } + + ctx->rst = 1; } if (ctx->type == NGX_HTTP_V2_GOAWAY_FRAME) { |