summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2018-01-25 10:31:22 +0300
committerValentin Bartenev <vbart@nginx.com>2018-01-25 10:31:22 +0300
commit7fe8f72364fbac68cd82abf8fc775cce965a4a1e (patch)
tree876a02de10682f00f4bf088801898f8e650dd3d9
parent4b19848e4e4f5472042a1621178d4c3b86f427ef (diff)
downloadunit-7fe8f72364fbac68cd82abf8fc775cce965a4a1e.tar.gz
unit-7fe8f72364fbac68cd82abf8fc775cce965a4a1e.tar.bz2
HTTP parser: simplified nxt_http_parse_field_value().
There's no need in loop after 4ac474b68658. Found by Coverity (CID 259713).
Diffstat (limited to '')
-rw-r--r--src/nxt_http_parse.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 7393e19e..65de0d60 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -629,27 +629,23 @@ nxt_http_parse_field_value(nxt_http_request_parse_t *rp, u_char **pos,
p += rp->field_value.length;
- for ( ;; ) {
- p = nxt_http_lookup_field_end(p, end);
-
- if (nxt_slow_path(p == end)) {
- len = p - *pos;
+ p = nxt_http_lookup_field_end(p, end);
- if (nxt_slow_path(len > NXT_HTTP_MAX_FIELD_VALUE)) {
- return NXT_HTTP_PARSE_TOO_LARGE_FIELD;
- }
+ if (nxt_slow_path(p == end)) {
+ len = p - *pos;
- rp->field_value.length = len;
- rp->handler = &nxt_http_parse_field_value;
- return NXT_AGAIN;
+ if (nxt_slow_path(len > NXT_HTTP_MAX_FIELD_VALUE)) {
+ return NXT_HTTP_PARSE_TOO_LARGE_FIELD;
}
- ch = *p;
+ rp->field_value.length = len;
+ rp->handler = &nxt_http_parse_field_value;
+ return NXT_AGAIN;
+ }
- if (nxt_fast_path(ch == '\r' || ch == '\n')) {
- break;
- }
+ ch = *p;
+ if (nxt_slow_path(ch != '\r' && ch != '\n')) {
return NXT_HTTP_PARSE_INVALID;
}