aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_grpc_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules/ngx_http_grpc_module.c')
-rw-r--r--src/http/modules/ngx_http_grpc_module.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c
index 80046d6a4..4c95525b4 100644
--- a/src/http/modules/ngx_http_grpc_module.c
+++ b/src/http/modules/ngx_http_grpc_module.c
@@ -1869,7 +1869,8 @@ ngx_http_grpc_process_header(ngx_http_request_t *r)
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
}
- if (status < NGX_HTTP_OK) {
+ if (status < NGX_HTTP_OK && status != NGX_HTTP_EARLY_HINTS)
+ {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"upstream sent unexpected :status \"%V\"",
status_line);
@@ -1902,6 +1903,10 @@ ngx_http_grpc_process_header(ngx_http_request_t *r)
h->lowcase_key = h->key.data;
h->hash = ngx_hash_key(h->key.data, h->key.len);
+ if (u->headers_in.status_n == NGX_HTTP_EARLY_HINTS) {
+ continue;
+ }
+
hh = ngx_hash_find(&umcf->headers_in_hash, h->hash,
h->lowcase_key, h->key.len);
@@ -1923,6 +1928,17 @@ ngx_http_grpc_process_header(ngx_http_request_t *r)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"grpc header done");
+ if (u->headers_in.status_n == NGX_HTTP_EARLY_HINTS) {
+ if (ctx->end_stream) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "upstream prematurely closed stream");
+ return NGX_HTTP_UPSTREAM_INVALID_HEADER;
+ }
+
+ ctx->status = 0;
+ return NGX_HTTP_UPSTREAM_EARLY_HINTS;
+ }
+
if (ctx->end_stream) {
u->headers_in.content_length_n = 0;
@@ -4413,6 +4429,7 @@ ngx_http_grpc_create_loc_conf(ngx_conf_t *cf)
conf->upstream.pass_request_body = 1;
conf->upstream.force_ranges = 0;
conf->upstream.pass_trailers = 1;
+ conf->upstream.pass_early_hints = 1;
conf->upstream.preserve_output = 1;
conf->headers_source = NGX_CONF_UNSET_PTR;