Mercurial > hg > nginx
comparison src/http/v2/ngx_http_v2.c @ 7216:aa60f5799a4c
HTTP/2: style.
Unified the style of validity checks in ngx_http_v2_validate_header().
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 22 Feb 2018 12:42:29 +0300 |
parents | 3dfe9444324b |
children | e80930e5e422 |
comparison
equal
deleted
inserted
replaced
7215:2dc837d16099 | 7216:aa60f5799a4c |
---|---|
3255 || (ch == '_' && cscf->underscores_in_headers)) | 3255 || (ch == '_' && cscf->underscores_in_headers)) |
3256 { | 3256 { |
3257 continue; | 3257 continue; |
3258 } | 3258 } |
3259 | 3259 |
3260 switch (ch) { | 3260 if (ch == '\0' || ch == LF || ch == CR || ch == ':' |
3261 case '\0': | 3261 || (ch >= 'A' && ch <= 'Z')) |
3262 case LF: | 3262 { |
3263 case CR: | |
3264 case ':': | |
3265 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 3263 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
3266 "client sent invalid header name: \"%V\"", | 3264 "client sent invalid header name: \"%V\"", |
3267 &header->name); | 3265 &header->name); |
3268 | 3266 |
3269 return NGX_ERROR; | 3267 return NGX_ERROR; |
3270 } | 3268 } |
3271 | 3269 |
3272 if (ch >= 'A' && ch <= 'Z') { | |
3273 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | |
3274 "client sent invalid header name: \"%V\"", | |
3275 &header->name); | |
3276 | |
3277 return NGX_ERROR; | |
3278 } | |
3279 | |
3280 r->invalid_header = 1; | 3270 r->invalid_header = 1; |
3281 } | 3271 } |
3282 | 3272 |
3283 for (i = 0; i != header->value.len; i++) { | 3273 for (i = 0; i != header->value.len; i++) { |
3284 ch = header->value.data[i]; | 3274 ch = header->value.data[i]; |
3285 | 3275 |
3286 switch (ch) { | 3276 if (ch == '\0' || ch == LF || ch == CR) { |
3287 case '\0': | |
3288 case LF: | |
3289 case CR: | |
3290 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 3277 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
3291 "client sent header \"%V\" with " | 3278 "client sent header \"%V\" with " |
3292 "invalid value: \"%V\"", | 3279 "invalid value: \"%V\"", |
3293 &header->name, &header->value); | 3280 &header->name, &header->value); |
3294 | 3281 |