]> git.kaiwu.me - nginx.git/commitdiff
HTTP/2: style.
authorRuslan Ermilov <ru@nginx.com>
Thu, 22 Feb 2018 09:42:29 +0000 (12:42 +0300)
committerRuslan Ermilov <ru@nginx.com>
Thu, 22 Feb 2018 09:42:29 +0000 (12:42 +0300)
Unified the style of validity checks in ngx_http_v2_validate_header().

src/http/v2/ngx_http_v2.c

index 7bea204fcfe79b6ceaae348f7c52e88e763e092d..d9df0f90e8ccf0a5c422348b39cdbc67a964a8bc 100644 (file)
@@ -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\"",