diff options
author | Ruslan Ermilov <ru@nginx.com> | 2018-02-22 12:42:29 +0300 |
---|---|---|
committer | Ruslan Ermilov <ru@nginx.com> | 2018-02-22 12:42:29 +0300 |
commit | bcda92e843ca4f80df96bceba5918a73eaf1a71c (patch) | |
tree | b9e05a578e53c925c1903a902a56f7574d6e0004 | |
parent | b3b4a98a5c24d1d0a155f832182b4a2ea1de0984 (diff) | |
download | nginx-bcda92e843ca4f80df96bceba5918a73eaf1a71c.tar.gz nginx-bcda92e843ca4f80df96bceba5918a73eaf1a71c.zip |
HTTP/2: style.
Unified the style of validity checks in ngx_http_v2_validate_header().
-rw-r--r-- | src/http/v2/ngx_http_v2.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index 7bea204fc..d9df0f90e 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -3257,19 +3257,9 @@ ngx_http_v2_validate_header(ngx_http_request_t *r, ngx_http_v2_header_t *header) continue; } - switch (ch) { - case '\0': - case LF: - case CR: - case ':': - ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, - "client sent invalid header name: \"%V\"", - &header->name); - - return NGX_ERROR; - } - - if (ch >= 'A' && ch <= 'Z') { + if (ch == '\0' || ch == LF || ch == CR || ch == ':' + || (ch >= 'A' && ch <= 'Z')) + { ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "client sent invalid header name: \"%V\"", &header->name); @@ -3283,10 +3273,7 @@ ngx_http_v2_validate_header(ngx_http_request_t *r, ngx_http_v2_header_t *header) for (i = 0; i != header->value.len; i++) { ch = header->value.data[i]; - switch (ch) { - case '\0': - case LF: - case CR: + if (ch == '\0' || ch == LF || ch == CR) { ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "client sent header \"%V\" with " "invalid value: \"%V\"", |