Skip to content

Commit

Permalink
HTTP/2: style.
Browse files Browse the repository at this point in the history
Unified the style of validity checks in ngx_http_v2_validate_header().
  • Loading branch information
mdocguard committed Feb 22, 2018
1 parent b3b4a98 commit bcda92e
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/http/v2/ngx_http_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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\"",
Expand Down

0 comments on commit bcda92e

Please sign in to comment.