| line |
true |
false |
branch |
|
5
|
578 |
16 |
if (likely(!req)) { |
|
6
|
436 |
142 |
FEER_REQ_ALLOC(req); |
|
37
|
100 |
579 |
if (unlikely(c->pipelined)) goto pipelined; |
|
41
|
0 |
579 |
if (unlikely(revents & EV_ERROR && !(revents & EV_READ))) { |
|
|
0 |
0 |
if (unlikely(revents & EV_ERROR && !(revents & EV_READ))) { |
|
46
|
0 |
579 |
if (unlikely(c->receiving == RECEIVE_SHUTDOWN)) |
|
51
|
533 |
46 |
if (unlikely(!c->rbuf)) { // unlikely = optimize for keepalive requests |
|
58
|
27 |
552 |
if (unlikely(space_free < READ_BUFSZ)) { // unlikely = optimize for small |
|
61
|
0 |
27 |
if (unlikely(cur_len + READ_GROW_FACTOR*READ_BUFSZ > c->cached_max_read_buf)) { |
|
70
|
27 |
0 |
SvGROW(c->rbuf, new_len); |
|
|
27 |
0 |
SvGROW(c->rbuf, new_len); |
|
77
|
28 |
551 |
if (unlikely(got_n <= 0)) { |
|
78
|
26 |
2 |
if (unlikely(got_n == 0)) { |
|
82
|
2 |
0 |
if (likely(errno == EAGAIN || errno == EINTR)) |
|
|
0 |
2 |
if (likely(errno == EAGAIN || errno == EINTR)) |
|
90
|
6 |
545 |
if (c->receiving == RECEIVE_WAIT) |
|
100
|
131 |
559 |
if (unlikely(c->receiving == RECEIVE_PROXY_HEADER)) { |
|
102
|
92 |
39 |
if (ret == -1) { |
|
106
|
0 |
39 |
if (ret == -2) goto try_read_again_reset_timer; |
|
110
|
39 |
0 |
if (remaining > 0) |
|
115
|
0 |
39 |
feer_clear_remote_cache(c); |
|
|
0 |
39 |
feer_clear_remote_cache(c); |
|
119
|
39 |
0 |
if (remaining > 0) { |
|
127
|
545 |
14 |
if (likely(c->receiving <= RECEIVE_HEADERS)) { |
|
129
|
16 |
529 |
if (ret == -1) goto try_read_bad; |
|
131
|
22 |
507 |
if (ret == -2) goto try_read_again_reset_timer; |
|
139
|
15 |
492 |
if (process_request_headers(c, ret)) |
|
144
|
10 |
4 |
else if (likely(c->receiving == RECEIVE_BODY)) { |
|
146
|
1 |
9 |
if (c->received_cl < c->expected_cl) |
|
152
|
4 |
0 |
else if (c->receiving == RECEIVE_CHUNKED) { |
|
155
|
0 |
4 |
if (ret == 1) |
|
157
|
0 |
4 |
if (ret == -1) { |
|
165
|
0 |
0 |
else if (c->receiving == RECEIVE_STREAMING) { |
|
168
|
0 |
0 |
if (c->poll_read_cb) { |
|
172
|
0 |
0 |
if (c->receiving >= RECEIVE_SHUTDOWN) |
|
175
|
0 |
0 |
if (c->expected_cl > 0 && c->received_cl >= c->expected_cl) { |
|
|
0 |
0 |
if (c->expected_cl > 0 && c->received_cl >= c->expected_cl) { |
|
219
|
4 |
0 |
if (unlikely(!(revents & EV_TIMER) || c->receiving == RECEIVE_SHUTDOWN)) { |
|
|
0 |
4 |
if (unlikely(!(revents & EV_TIMER) || c->receiving == RECEIVE_SHUTDOWN)) { |
|
221
|
0 |
0 |
if (revents & EV_ERROR) |
|
248
|
4 |
0 |
if (likely(c->responding == RESPOND_NOT_STARTED) && c->receiving >= RECEIVE_HEADERS) { |
|
|
3 |
1 |
if (likely(c->responding == RESPOND_NOT_STARTED) && c->receiving >= RECEIVE_HEADERS) { |
|
250
|
0 |
3 |
if (c->tls && !c->tls_handshake_done) { |
|
|
0 |
0 |
if (c->tls && !c->tls_handshake_done) { |
|
260
|
0 |
3 |
if (c->receiving == RECEIVE_PROXY_HEADER) { |
|
263
|
2 |
1 |
else if (c->receiving == RECEIVE_HEADERS) { |
|
289
|
8 |
0 |
if (unlikely(!(revents & EV_TIMER) || c->receiving == RECEIVE_SHUTDOWN)) { |
|
|
0 |
8 |
if (unlikely(!(revents & EV_TIMER) || c->receiving == RECEIVE_SHUTDOWN)) { |
|
290
|
0 |
0 |
if (revents & EV_ERROR) |
|
297
|
0 |
8 |
if ((c->receiving == RECEIVE_HEADERS || c->receiving == RECEIVE_PROXY_HEADER) |
|
|
0 |
0 |
if ((c->receiving == RECEIVE_HEADERS || c->receiving == RECEIVE_PROXY_HEADER) |
|
298
|
0 |
8 |
&& c->responding == RESPOND_NOT_STARTED) { |
|
301
|
4 |
4 |
if (c->tls && !c->tls_handshake_done) { |
|
|
4 |
0 |
if (c->tls && !c->tls_handshake_done) { |
|
326
|
0 |
0 |
if (unlikely(!(revents & EV_TIMER) || c->responding == RESPOND_SHUTDOWN)) { |
|
|
0 |
0 |
if (unlikely(!(revents & EV_TIMER) || c->responding == RESPOND_SHUTDOWN)) { |
|
327
|
0 |
0 |
if (revents & EV_ERROR) |
|
349
|
0 |
589 |
if (unlikely(prep_socket(fd, lsnr->is_tcp))) { |
|
351
|
0 |
0 |
if (unlikely(close(fd) < 0)) |
|
359
|
588 |
1 |
if (srvr->header_timeout > 0.0) { |
|
369
|
59 |
530 |
if (lsnr->tls_ctx_ref) { |
|
402
|
0 |
0 |
if (lsnr->server->shutting_down) return; |
|
424
|
518 |
590 |
if (fd == -1) { |
|
425
|
0 |
518 |
if (errno == EINTR) return 1; |
|
426
|
518 |
0 |
if (errno == EMFILE || errno == ENFILE) { |
|
|
0 |
518 |
if (errno == EMFILE || errno == ENFILE) { |
|
437
|
589 |
1 |
if (srvr->max_connections > 0 && srvr->active_conns >= srvr->max_connections) { |
|
|
2 |
587 |
if (srvr->max_connections > 0 && srvr->active_conns >= srvr->max_connections) { |
|
438
|
1 |
1 |
if (!feer_server_recycle_idle_conn(srvr)) { |
|
458
|
0 |
0 |
if (unlikely(srvr->shutting_down)) { |
|
463
|
0 |
0 |
if (unlikely(revents & EV_ERROR)) { |
|
470
|
0 |
0 |
while (accept_count++ < srvr->max_accept_per_loop) { |
|
471
|
0 |
0 |
if (epoll_wait(lsnr->epoll_fd, events, 1, 0) <= 0) break; |
|
472
|
0 |
0 |
if (!try_accept_one(EV_A, lsnr, srvr)) break; |
|
483
|
0 |
519 |
if (unlikely(srvr->shutting_down)) { |
|
488
|
0 |
519 |
if (unlikely(revents & EV_ERROR)) { |
|
497
|
1108 |
0 |
while (accept_count++ < srvr->max_accept_per_loop) { |
|
498
|
519 |
589 |
if (!try_accept_one(EV_A, lsnr, srvr)) break; |
|
508
|
2 |
189 |
if (srvr->use_epoll_exclusive) { |
|
513
|
0 |
2 |
if (lsnr->epoll_fd < 0) { |
|
520
|
0 |
2 |
if (epoll_ctl(lsnr->epoll_fd, EPOLL_CTL_ADD, listen_fd, &ev) < 0) { |
|
522
|
0 |
0 |
if (unlikely(close(lsnr->epoll_fd) < 0)) |
|
558
|
328 |
154 |
if (!ev_is_active(&server->ei)) { |
|
571
|
0 |
70 |
if (!c->rbuf) return 1; // need data |
|
582
|
5521 |
2 |
while (read_pos < buf_len) { |
|
583
|
2 |
5519 |
if (c->chunk_remaining == CHUNK_STATE_NEED_CRLF) { |
|
586
|
0 |
2 |
if (remaining < 2) |
|
588
|
2 |
0 |
if (buf[read_pos] != '\r' || buf[read_pos+1] != '\n') { |
|
|
0 |
2 |
if (buf[read_pos] != '\r' || buf[read_pos+1] != '\n') { |
|
596
|
2765 |
2754 |
else if (c->chunk_remaining == CHUNK_STATE_PARSE_SIZE) { |
|
604
|
5853 |
0 |
for (i = 0; i + 1 < remaining; i++) { |
|
605
|
2765 |
3088 |
if (line_start[i] == '\r' && line_start[i+1] == '\n') { |
|
|
2765 |
0 |
if (line_start[i] == '\r' && line_start[i+1] == '\n') { |
|
611
|
0 |
2765 |
if (!line_end) { |
|
622
|
2796 |
2749 |
while (p < line_end) { |
|
625
|
2781 |
15 |
if (val != 0xFF) { |
|
628
|
1 |
2780 |
if (chunk_size > (UV_MAX >> 4)) { |
|
634
|
8 |
7 |
else if (ch == ';' || ch == ' ' || ch == '\t') { |
|
|
6 |
2 |
else if (ch == ';' || ch == ' ' || ch == '\t') { |
|
|
6 |
0 |
else if (ch == ';' || ch == ' ' || ch == '\t') { |
|
645
|
4 |
2754 |
if (hex_digits == 0) { |
|
656
|
52 |
2702 |
if (chunk_size == 0) { |
|
669
|
0 |
2702 |
if (unlikely(chunk_size > (UV)c->cached_max_body_len)) { |
|
673
|
0 |
2702 |
if (unlikely(write_pos > (STRLEN)(c->cached_max_body_len - chunk_size))) { |
|
681
|
0 |
2702 |
if (unlikely(c->chunk_count > MAX_CHUNK_COUNT)) { |
|
686
|
0 |
2702 |
if (chunk_size > (UV)SSIZE_MAX) return -1; |
|
689
|
52 |
2702 |
else if (c->chunk_remaining == 0) { |
|
696
|
5794 |
0 |
while (i + 1 < remaining) { |
|
697
|
317 |
5477 |
if (trailer_start[i] == '\r' && trailer_start[i+1] == '\n') { |
|
|
317 |
0 |
if (trailer_start[i] == '\r' && trailer_start[i+1] == '\n') { |
|
698
|
50 |
267 |
if (i == 0) { |
|
701
|
2 |
48 |
STRLEN pipelined = (read_pos < buf_len) ? buf_len - read_pos : 0; |
|
704
|
2 |
48 |
if (pipelined > 0) |
|
710
|
2 |
265 |
if (unlikely(++c->trailer_count > MAX_TRAILER_HEADERS)) { |
|
728
|
1 |
2701 |
if (to_copy > remaining) |
|
732
|
2702 |
0 |
if (write_pos != read_pos && to_copy > 0) { |
|
|
2702 |
0 |
if (write_pos != read_pos && to_copy > 0) { |
|
740
|
1 |
2701 |
if (c->chunk_remaining > 0) { |
|
747
|
2 |
2699 |
if (remaining < 2) { |
|
752
|
2697 |
2 |
if (buf[read_pos] != '\r' || buf[read_pos+1] != '\n') { |
|
|
0 |
2697 |
if (buf[read_pos] != '\r' || buf[read_pos+1] != '\n') { |
|
763
|
3 |
2 |
if (read_pos > write_pos) { |
|
764
|
0 |
3 |
if (read_pos < buf_len) { |
|
804
|
219 |
337 |
c->is_keepalive = c->cached_keepalive_default && c->is_http11; |
|
|
211 |
8 |
c->is_keepalive = c->cached_keepalive_default && c->is_http11; |
|
816
|
392 |
1 |
if (likely(memcmp(req->method, "GET", 3) == 0)) { |
|
818
|
1 |
0 |
} else if (memcmp(req->method, "PUT", 3) == 0) { |
|
825
|
151 |
1 |
if (likely(memcmp(req->method, "POST", 4) == 0)) { |
|
827
|
1 |
0 |
} else if (memcmp(req->method, "HEAD", 4) == 0) { |
|
834
|
2 |
0 |
if (memcmp(req->method, "PATCH", 5) == 0) { |
|
841
|
1 |
1 |
if (memcmp(req->method, "DELETE", 6) == 0) { |
|
848
|
1 |
0 |
if (memcmp(req->method, "OPTIONS", 7) == 0) { |
|
862
|
3 |
546 |
if (unlikely(req->uri_len > c->cached_max_uri_len)) { |
|
881
|
546 |
0 |
if (unlikely(body_offset < 0 || (STRLEN)body_offset > from_len)) { |
|
|
0 |
546 |
if (unlikely(body_offset < 0 || (STRLEN)body_offset > from_len)) { |
|
890
|
235 |
311 |
SV *new_rbuf = newSVpvn(need > 0 ? from : "", need); |
|
901
|
1359 |
504 |
for (i=0; i < req->num_headers; i++) { |
|
904
|
1 |
1358 |
if (unlikely(!hdr->name)) { |
|
911
|
2 |
1356 |
if (unlikely(hdr->name_len > MAX_HEADER_NAME_LEN)) { |
|
916
|
75 |
1281 |
if (unlikely(hdr->name_len == 14 && |
|
|
75 |
0 |
if (unlikely(hdr->name_len == 14 && |
|
920
|
3 |
72 |
if (c->receive_chunked) { |
|
927
|
70 |
2 |
if (likely(g == IS_NUMBER_IN_UV)) { |
|
928
|
3 |
67 |
if (unlikely(new_expected > (UV)c->cached_max_body_len)) { |
|
934
|
4 |
63 |
if (got_content_length && new_expected != expected) { |
|
|
2 |
2 |
if (got_content_length && new_expected != expected) { |
|
948
|
503 |
778 |
else if (unlikely(hdr->name_len == 10 && |
|
|
357 |
146 |
else if (unlikely(hdr->name_len == 10 && |
|
951
|
352 |
5 |
if (c->is_http11 && c->is_keepalive && |
|
|
74 |
278 |
if (c->is_http11 && c->is_keepalive && |
|
952
|
66 |
8 |
hdr->value_len == 5 && str_case_eq_fixed("close", hdr->value, 5)) |
|
|
66 |
0 |
hdr->value_len == 5 && str_case_eq_fixed("close", hdr->value, 5)) |
|
957
|
5 |
286 |
else if (!c->is_http11 && c->cached_keepalive_default && |
|
|
5 |
0 |
else if (!c->is_http11 && c->cached_keepalive_default && |
|
958
|
1 |
4 |
hdr->value_len == 10 && str_case_eq_fixed("keep-alive", hdr->value, 10)) |
|
|
1 |
0 |
hdr->value_len == 10 && str_case_eq_fixed("keep-alive", hdr->value, 10)) |
|
963
|
256 |
101 |
if (next_req_follows && c->receive_chunked && (!c->is_http11 || got_host)) break; |
|
|
0 |
256 |
if (next_req_follows && c->receive_chunked && (!c->is_http11 || got_host)) break; |
|
|
0 |
0 |
if (next_req_follows && c->receive_chunked && (!c->is_http11 || got_host)) break; |
|
|
0 |
0 |
if (next_req_follows && c->receive_chunked && (!c->is_http11 || got_host)) break; |
|
965
|
898 |
26 |
else if (unlikely(c->is_http11 && hdr->name_len == 6 && |
|
|
37 |
861 |
else if (unlikely(c->is_http11 && hdr->name_len == 6 && |
|
|
37 |
887 |
else if (unlikely(c->is_http11 && hdr->name_len == 6 && |
|
|
22 |
15 |
else if (unlikely(c->is_http11 && hdr->name_len == 6 && |
|
982
|
876 |
26 |
else if (unlikely(c->is_http11 && hdr->name_len == 17 && |
|
|
110 |
766 |
else if (unlikely(c->is_http11 && hdr->name_len == 17 && |
|
|
110 |
792 |
else if (unlikely(c->is_http11 && hdr->name_len == 17 && |
|
|
98 |
12 |
else if (unlikely(c->is_http11 && hdr->name_len == 17 && |
|
987
|
6 |
92 |
if (got_transfer_encoding) { |
|
996
|
82 |
8 |
bool is_chunked = (hdr->value_len >= 7 && |
|
997
|
90 |
2 |
str_case_eq_fixed("chunked", hdr->value, 7) && |
|
998
|
3 |
79 |
(hdr->value_len == 7 || |
|
999
|
1 |
2 |
hdr->value[7] == ';' || |
|
1000
|
0 |
1 |
hdr->value[7] == ' ' || |
|
1001
|
0 |
0 |
hdr->value[7] == '\t')); |
|
1007
|
82 |
10 |
if (is_chunked) { |
|
1010
|
8 |
74 |
if (got_content_length) { |
|
1018
|
6 |
4 |
else if (is_identity) { |
|
1029
|
546 |
258 |
else if (unlikely(hdr->name_len == 4 && |
|
|
546 |
0 |
else if (unlikely(hdr->name_len == 4 && |
|
1037
|
489 |
15 |
if (unlikely(c->is_http11 && !got_host)) { |
|
|
1 |
488 |
if (unlikely(c->is_http11 && !got_host)) { |
|
1043
|
27 |
476 |
if (c->cached_max_conn_reqs > 0 && c->reqs >= c->cached_max_conn_reqs) { |
|
|
1 |
26 |
if (c->cached_max_conn_reqs > 0 && c->reqs >= c->cached_max_conn_reqs) { |
|
1048
|
388 |
115 |
if (likely(next_req_follows) && !got_content_length && !c->receive_chunked) goto got_it_all; |
|
|
388 |
0 |
if (likely(next_req_follows) && !got_content_length && !c->receive_chunked) goto got_it_all; |
|
|
388 |
0 |
if (likely(next_req_follows) && !got_content_length && !c->receive_chunked) goto got_it_all; |
|
1049
|
45 |
70 |
else if (likely(got_content_length)) goto got_cl; |
|
1050
|
66 |
4 |
else if (unlikely(c->receive_chunked)) goto got_chunked; |
|
1065
|
45 |
0 |
SvGROW(c->rbuf, c->expected_cl + 1); |
|
|
2 |
43 |
SvGROW(c->rbuf, c->expected_cl + 1); |
|
1069
|
44 |
1 |
if (unlikely(c->expected_cl && c->received_cl < c->expected_cl)) { |
|
|
12 |
32 |
if (unlikely(c->expected_cl && c->received_cl < c->expected_cl)) { |
|
1092
|
5 |
61 |
if (ret == 1) |
|
1094
|
15 |
46 |
if (ret == -1) { |
|
1117
|
570 |
690 |
if (c->in_callback) { |
|
1125
|
46 |
644 |
if (c->tls) { |
|
1170
|
65 |
13 |
if (likely(!c->expect_continue)) |
|
1175
|
2 |
11 |
if (c->tls) { |
|
1178
|
0 |
2 |
if (c->tls_wbuf.off > 0) |
|
1187
|
0 |
11 |
if (likely(wr > 0)) { |
|
1190
|
0 |
0 |
else if (wr < 0 && errno != EAGAIN && errno != EINTR) { |
|
|
0 |
0 |
else if (wr < 0 && errno != EAGAIN && errno != EINTR) { |
|
1199
|
133 |
576 |
if (unlikely(!req)) |
|
1202
|
418 |
158 |
if (req->buf) |
|
1204
|
283 |
293 |
if (likely(req->path)) |
|
1206
|
283 |
293 |
if (likely(req->query)) |
|
1214
|
576 |
0 |
FEER_REQ_FREE(req); |
|
1237
|
1 |
189 |
if (unlikely(c->responding != RESPOND_NOT_STARTED)) { |