details:   http://hg.nginx.org/nginx/rev/aa60f5799a4c
branches:  
changeset: 7216:aa60f5799a4c
user:      Ruslan Ermilov <r...@nginx.com>
date:      Thu Feb 22 12:42:29 2018 +0300
description:
HTTP/2: style.

Unified the style of validity checks in ngx_http_v2_validate_header().

diffstat:

 src/http/v2/ngx_http_v2.c |  21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)

diffs (38 lines):

diff -r 2dc837d16099 -r aa60f5799a4c src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Wed Feb 21 17:26:00 2018 +0300
+++ b/src/http/v2/ngx_http_v2.c Thu Feb 22 12:42:29 2018 +0300
@@ -3257,19 +3257,9 @@ ngx_http_v2_validate_header(ngx_http_req
             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_req
     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\"",
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to