| line |
true |
false |
branch |
|
8
|
15 |
3 |
if (!val || val_len == 0) return NULL; |
|
|
0 |
15 |
if (!val || val_len == 0) return NULL; |
|
11
|
15 |
0 |
while (val_len > 0 && (*val == ' ' || *val == '\t')) { val++; val_len--; } |
|
|
0 |
15 |
while (val_len > 0 && (*val == ' ' || *val == '\t')) { val++; val_len--; } |
|
|
0 |
15 |
while (val_len > 0 && (*val == ' ' || *val == '\t')) { val++; val_len--; } |
|
12
|
0 |
15 |
if (val_len == 0) return NULL; |
|
16
|
178 |
9 |
while (ip_len < val_len && val[ip_len] != ',' && val[ip_len] != ' ') ip_len++; |
|
|
173 |
5 |
while (ip_len < val_len && val[ip_len] != ',' && val[ip_len] != ' ') ip_len++; |
|
|
172 |
1 |
while (ip_len < val_len && val[ip_len] != ',' && val[ip_len] != ' ') ip_len++; |
|
18
|
15 |
0 |
if (ip_len == 0 || ip_len > 45) return NULL; // max IPv6 length is 45 chars |
|
|
0 |
15 |
if (ip_len == 0 || ip_len > 45) return NULL; // max IPv6 length is 45 chars |
|
28
|
9 |
6 |
if (inet_pton(AF_INET, ip_buf, &addr4) == 1) { |
|
31
|
2 |
4 |
if (inet_pton(AF_INET6, ip_buf, &addr6) == 1) { |
|
45
|
7 |
10 |
if (!val || val_len == 0) return NULL; |
|
|
0 |
7 |
if (!val || val_len == 0) return NULL; |
|
48
|
7 |
0 |
while (val_len > 0 && (*val == ' ' || *val == '\t')) { val++; val_len--; } |
|
|
0 |
7 |
while (val_len > 0 && (*val == ' ' || *val == '\t')) { val++; val_len--; } |
|
|
0 |
7 |
while (val_len > 0 && (*val == ' ' || *val == '\t')) { val++; val_len--; } |
|
51
|
7 |
0 |
if (val_len >= 5 && str_case_eq_fixed("https", val, 5) && |
|
|
7 |
0 |
if (val_len >= 5 && str_case_eq_fixed("https", val, 5) && |
|
52
|
1 |
6 |
(val_len == 5 || val[5] == ' ' || val[5] == '\t' || val[5] == ',')) |
|
|
1 |
0 |
(val_len == 5 || val[5] == ' ' || val[5] == '\t' || val[5] == ',')) |
|
|
1 |
0 |
(val_len == 5 || val[5] == ' ' || val[5] == '\t' || val[5] == ',')) |
|
|
1 |
0 |
(val_len == 5 || val[5] == ' ' || val[5] == '\t' || val[5] == ',')) |
|
54
|
0 |
0 |
if (val_len >= 4 && str_case_eq_fixed("http", val, 4) && |
|
|
0 |
0 |
if (val_len >= 4 && str_case_eq_fixed("http", val, 4) && |
|
55
|
0 |
0 |
(val_len == 4 || val[4] == ' ' || val[4] == '\t' || val[4] == ',')) |
|
|
0 |
0 |
(val_len == 4 || val[4] == ' ' || val[4] == '\t' || val[4] == ',')) |
|
|
0 |
0 |
(val_len == 4 || val[4] == ' ' || val[4] == '\t' || val[4] == ',')) |
|
|
0 |
0 |
(val_len == 4 || val[4] == ' ' || val[4] == '\t' || val[4] == ',')) |
|
72
|
39 |
269 |
if (c->tls) return newSVpvs("https"); |
|
74
|
2 |
267 |
if (c->proxy_ssl) return newSVpvs("https"); |
|
75
|
23 |
244 |
if (c->proxy_proto_version > 0 && c->proxy_dst_port == 443) |
|
|
5 |
18 |
if (c->proxy_proto_version > 0 && c->proxy_dst_port == 443) |
|
77
|
17 |
245 |
if (c->cached_use_reverse_proxy && c->req) { |
|
|
17 |
0 |
if (c->cached_use_reverse_proxy && c->req) { |
|
79
|
7 |
10 |
if (fwd) return fwd; |
|
87
|
0 |
57 |
if (psgi_env_version) return; |
|
124
|
57 |
240 |
if (unlikely(!psgi_env_version)) |
|
136
|
297 |
0 |
hv_stores(e, "SERVER_NAME", |
|
138
|
297 |
0 |
hv_stores(e, "SERVER_PORT", |
|
156
|
13 |
284 |
if (c->cached_use_reverse_proxy) { |
|
158
|
5 |
8 |
hv_stores(e, "REMOTE_ADDR", fwd_addr ? fwd_addr : SvREFCNT_inc_simple_NN(c->remote_addr)); |
|
166
|
249 |
48 |
hv_stores(e, "psgi.url_scheme", scheme ? scheme : newSVpvs("http")); |
|
175
|
0 |
297 |
hv_stores(e, "psgi.multiprocess", |
|
|
0 |
297 |
hv_stores(e, "psgi.multiprocess", |
|
178
|
93 |
204 |
if (c->cached_request_cb_is_psgi && c->server->psgix_io) { |
|
|
93 |
0 |
if (c->cached_request_cb_is_psgi && c->server->psgix_io) { |
|
185
|
0 |
297 |
if (c->trailers) { |
|
189
|
1 |
296 |
if (c->proxy_tlvs) { |
|
193
|
296 |
1 |
if (likely(!r->path)) feersum_set_path_and_query(aTHX_ r); |
|
200
|
848 |
297 |
for (i=0; inum_headers; i++) { |
|
219
|
0 |
795 |
if (unlikely(hdr->name_len > MAX_HEADER_NAME_LEN)) { |
|
227
|
6714 |
795 |
for (j=0; jname_len; j++) { |
|
237
|
0 |
795 |
if (unlikely(fetched == NULL)) { |
|
242
|
2 |
793 |
if (unlikely(SvPOK(cur_val))) { |
|
245
|
0 |
2 |
const char *sep = (hdr->name_len == 6 |
|
246
|
0 |
0 |
&& str_case_eq_fixed("cookie", hdr->name, 6)) ? "; " : ", "; |
|
311
|
7 |
0 |
if (r->num_headers > 0) |
|
316
|
0 |
3 |
COPY_NORM_HEADER(n) |
|
|
22 |
3 |
COPY_NORM_HEADER(n) |
|
|
0 |
3 |
COPY_NORM_HEADER(n) |
|
|
0 |
3 |
COPY_NORM_HEADER(n) |
|
|
0 |
0 |
COPY_NORM_HEADER(n) |
|
|
0 |
0 |
COPY_NORM_HEADER(n) |
|
|
3 |
1 |
COPY_NORM_HEADER(n) |
|
318
|
0 |
9 |
COPY_NORM_HEADER(ascii_lower[(unsigned char)n]) |
|
|
60 |
9 |
COPY_NORM_HEADER(ascii_lower[(unsigned char)n]) |
|
|
0 |
9 |
COPY_NORM_HEADER(ascii_lower[(unsigned char)n]) |
|
|
2 |
7 |
COPY_NORM_HEADER(ascii_lower[(unsigned char)n]) |
|
|
2 |
0 |
COPY_NORM_HEADER(ascii_lower[(unsigned char)n]) |
|
|
1 |
1 |
COPY_NORM_HEADER(ascii_lower[(unsigned char)n]) |
|
|
9 |
2 |
COPY_NORM_HEADER(ascii_lower[(unsigned char)n]) |
|
320
|
0 |
3 |
COPY_NORM_HEADER(ascii_upper[(unsigned char)n]) |
|
|
22 |
3 |
COPY_NORM_HEADER(ascii_upper[(unsigned char)n]) |
|
|
0 |
3 |
COPY_NORM_HEADER(ascii_upper[(unsigned char)n]) |
|
|
0 |
3 |
COPY_NORM_HEADER(ascii_upper[(unsigned char)n]) |
|
|
0 |
0 |
COPY_NORM_HEADER(ascii_upper[(unsigned char)n]) |
|
|
0 |
0 |
COPY_NORM_HEADER(ascii_upper[(unsigned char)n]) |
|
|
3 |
1 |
COPY_NORM_HEADER(ascii_upper[(unsigned char)n]) |
|
322
|
0 |
8 |
COPY_NORM_HEADER(ascii_lower_dash[(unsigned char)n]) |
|
|
72 |
8 |
COPY_NORM_HEADER(ascii_lower_dash[(unsigned char)n]) |
|
|
0 |
8 |
COPY_NORM_HEADER(ascii_lower_dash[(unsigned char)n]) |
|
|
0 |
8 |
COPY_NORM_HEADER(ascii_lower_dash[(unsigned char)n]) |
|
|
0 |
0 |
COPY_NORM_HEADER(ascii_lower_dash[(unsigned char)n]) |
|
|
0 |
0 |
COPY_NORM_HEADER(ascii_lower_dash[(unsigned char)n]) |
|
|
8 |
2 |
COPY_NORM_HEADER(ascii_lower_dash[(unsigned char)n]) |
|
324
|
0 |
3 |
COPY_NORM_HEADER(ascii_upper_dash[(unsigned char)n]) |
|
|
22 |
3 |
COPY_NORM_HEADER(ascii_upper_dash[(unsigned char)n]) |
|
|
0 |
3 |
COPY_NORM_HEADER(ascii_upper_dash[(unsigned char)n]) |
|
|
0 |
3 |
COPY_NORM_HEADER(ascii_upper_dash[(unsigned char)n]) |
|
|
0 |
0 |
COPY_NORM_HEADER(ascii_upper_dash[(unsigned char)n]) |
|
|
0 |
0 |
COPY_NORM_HEADER(ascii_upper_dash[(unsigned char)n]) |
|
|
3 |
1 |
COPY_NORM_HEADER(ascii_upper_dash[(unsigned char)n]) |
|
338
|
2 |
8 |
const bool is_cookie = (nlen == 6 && str_case_eq_fixed("cookie", np, 6)); |
|
|
1 |
1 |
const bool is_cookie = (nlen == 6 && str_case_eq_fixed("cookie", np, 6)); |
|
339
|
42 |
10 |
for (size_t i = 0; i < r->num_headers; i++) { |
|
341
|
16 |
26 |
if (unlikely(hdr->name_len == nlen |
|
|
12 |
4 |
if (unlikely(hdr->name_len == nlen |
|
343
|
10 |
2 |
if (likely(!result)) { |
|
346
|
1 |
1 |
sv_catpvn(result, is_cookie ? "; " : ", ", 2); |
|
351
|
10 |
0 |
return result ? result : &PL_sv_undef; |
|
367
|
0 |
12 |
PUSHMARK(SP); |
|
368
|
0 |
12 |
XPUSHs(sv); |
|
369
|
0 |
12 |
mXPUSHs(newSViv(fd)); |
|
375
|
12 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
12 |
if (unlikely(SvTRUE(ERRSV))) { |
|
376
|
0 |
0 |
FREETMPS; LEAVE; |
|
378
|
0 |
0 |
croak("Failed to create %s IO handle: %-p", who, ERRSV); |
|
380
|
0 |
12 |
if (unlikely(!SvROK(sv))) { |
|
381
|
0 |
0 |
FREETMPS; LEAVE; |
|
389
|
12 |
0 |
FREETMPS; |
|
398
|
1 |
12 |
if (unlikely(c->io_taken)) |
|
400
|
0 |
12 |
if (unlikely(c->responding != RESPOND_NOT_STARTED)) |
|
430
|
9 |
3 |
if (c->tls) { |
|
432
|
0 |
9 |
if (!c->tls_tunnel) |
|
450
|
3 |
0 |
if (likely(c->rbuf && SvOK(c->rbuf) && SvCUR(c->rbuf))) { |
|
|
3 |
0 |
if (likely(c->rbuf && SvOK(c->rbuf) && SvCUR(c->rbuf))) { |
|
|
3 |
0 |
if (likely(c->rbuf && SvOK(c->rbuf) && SvCUR(c->rbuf))) { |
|
|
1 |
2 |
if (likely(c->rbuf && SvOK(c->rbuf) && SvCUR(c->rbuf))) { |
|
454
|
1 |
0 |
if (io) { |
|
456
|
1 |
0 |
if (likely(pushed == (SSize_t)rbuf_len)) { |
|
459
|
0 |
0 |
} else if (pushed > 0) { |
|
487
|
1 |
3 |
if (c->tls_tunnel) |
|
493
|
3 |
0 |
if (!SvROK(io_sv) || !isGV_with_GP(SvRV(io_sv))) |
|
|
3 |
0 |
if (!SvROK(io_sv) || !isGV_with_GP(SvRV(io_sv))) |
|
|
0 |
3 |
if (!SvROK(io_sv) || !isGV_with_GP(SvRV(io_sv))) |
|
|
0 |
0 |
if (!SvROK(io_sv) || !isGV_with_GP(SvRV(io_sv))) |
|
497
|
3 |
0 |
IO *io = GvIO(gv); |
|
|
0 |
3 |
IO *io = GvIO(gv); |
|
|
0 |
0 |
IO *io = GvIO(gv); |
|
|
3 |
0 |
IO *io = GvIO(gv); |
|
498
|
3 |
0 |
if (!io || !IoIFP(io)) |
|
|
0 |
3 |
if (!io || !IoIFP(io)) |
|
505
|
0 |
3 |
if (cnt > 0) { |
|
510
|
0 |
0 |
if (ptr) { |
|
512
|
0 |
0 |
if (!c->rbuf) |
|
533
|
3 |
0 |
if (c->rbuf && cnt <= 0) |
|
|
3 |
0 |
if (c->rbuf && cnt <= 0) |
|
551
|
87 |
516 |
if (SvPOK(message)) { |
|
554
|
531 |
85 |
for (STRLEN k = 0; k < mlen; k++) |
|
555
|
530 |
1 |
if (unlikely(mp[k] == '\r' || mp[k] == '\n')) |
|
|
1 |
529 |
if (unlikely(mp[k] == '\r' || mp[k] == '\n')) |
|
560
|
777 |
592 |
for (I32 j = 0; j < avl; j += 2) { |
|
563
|
777 |
0 |
if (!hdr || !SvOK(hdr) || !val || !SvOK(val)) |
|
|
777 |
0 |
if (!hdr || !SvOK(hdr) || !val || !SvOK(val)) |
|
|
777 |
0 |
if (!hdr || !SvOK(hdr) || !val || !SvOK(val)) |
|
|
0 |
777 |
if (!hdr || !SvOK(hdr) || !val || !SvOK(val)) |
|
568
|
9203 |
774 |
for (STRLEN k = 0; k < hlen; k++) |
|
569
|
9202 |
1 |
if (unlikely(hp[k] == '\r' || hp[k] == '\n' || hp[k] == ':')) |
|
|
1 |
9201 |
if (unlikely(hp[k] == '\r' || hp[k] == '\n' || hp[k] == ':')) |
|
|
9201 |
2 |
if (unlikely(hp[k] == '\r' || hp[k] == '\n' || hp[k] == ':')) |
|
|
1 |
9200 |
if (unlikely(hp[k] == '\r' || hp[k] == '\n' || hp[k] == ':')) |
|
571
|
6534 |
768 |
for (STRLEN k = 0; k < vlen; k++) |
|
572
|
6529 |
5 |
if (unlikely(vp[k] == '\r' || vp[k] == '\n')) |
|
|
1 |
6528 |
if (unlikely(vp[k] == '\r' || vp[k] == '\n')) |
|
586
|
526 |
0 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
87 |
439 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
0 |
87 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
0 |
526 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
591
|
0 |
526 |
if (unlikely((avl+1) % 2 == 1)) { |
|
600
|
10 |
516 |
if (unlikely(err)) croak("%s", err); |
|
609
|
4 |
512 |
if (unlikely(c->responding != RESPOND_NOT_STARTED)) |
|
611
|
59 |
453 |
change_responding_state(c, streaming ? RESPOND_STREAMING : RESPOND_NORMAL); |
|
615
|
434 |
78 |
if (SvIOK(message)) |
|
620
|
0 |
78 |
if (unlikely(numtype != IS_NUMBER_IN_UV)) |
|
625
|
0 |
512 |
if (unlikely(!code)) |
|
633
|
78 |
434 |
if (likely(!SvPOK(message) || SvCUR(message) == 3)) { |
|
|
1 |
77 |
if (likely(!SvPOK(message) || SvCUR(message) == 3)) { |
|
652
|
509 |
3 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
|
509 |
0 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
|
507 |
2 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
|
507 |
0 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
|
507 |
0 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
663
|
662 |
512 |
for (I32 i = 0; i < avl; i += 2) { |
|
666
|
662 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
662 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
662 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
662 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
662 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
662 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
670
|
78 |
584 |
if (unlikely(hlen == 14) && str_case_eq_fixed("content-length", hp, 14)) { |
|
|
78 |
0 |
if (unlikely(hlen == 14) && str_case_eq_fixed("content-length", hp, 14)) { |
|
671
|
77 |
1 |
if (likely(c->auto_cl) && !streaming) |
|
|
68 |
9 |
if (likely(c->auto_cl) && !streaming) |
|
682
|
59 |
453 |
if (streaming && c->is_keepalive && !has_content_length |
|
|
7 |
52 |
if (streaming && c->is_keepalive && !has_content_length |
|
|
6 |
1 |
if (streaming && c->is_keepalive && !has_content_length |
|
683
|
1 |
5 |
&& !c->is_http11 && c->auto_cl) |
|
|
1 |
0 |
&& !c->is_http11 && c->auto_cl) |
|
687
|
496 |
16 |
if (likely(c->is_http11)) |
|
688
|
355 |
141 |
hdr_total += DATE_HEADER_LENGTH + (!c->is_keepalive ? 19 : 0); |
|
689
|
1 |
15 |
else if (c->is_keepalive) |
|
691
|
59 |
453 |
if (streaming) { |
|
692
|
50 |
9 |
if (c->is_http11 && !has_content_length && c->auto_cl) |
|
|
41 |
9 |
if (c->is_http11 && !has_content_length && c->auto_cl) |
|
|
40 |
1 |
if (c->is_http11 && !has_content_length && c->auto_cl) |
|
705
|
496 |
16 |
const char *ver = c->is_http11 ? "HTTP/1.1 " : "HTTP/1.0 "; |
|
711
|
662 |
512 |
for (I32 i = 0; i < avl; i += 2) { |
|
714
|
662 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
662 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
662 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
662 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
662 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
662 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
718
|
78 |
584 |
if (unlikely(hlen == 14) && str_case_eq_fixed("content-length", hp, 14)) { |
|
|
78 |
0 |
if (unlikely(hlen == 14) && str_case_eq_fixed("content-length", hp, 14)) { |
|
719
|
77 |
1 |
if (likely(c->auto_cl) && !streaming) |
|
|
68 |
9 |
if (likely(c->auto_cl) && !streaming) |
|
725
|
0 |
594 |
if (unlikely((p - SvPVX(hdr_sv)) + need > hdr_alloc)) { |
|
728
|
0 |
0 |
SvGROW(hdr_sv, hdr_alloc + 1); |
|
|
0 |
0 |
SvGROW(hdr_sv, hdr_alloc + 1); |
|
738
|
496 |
16 |
if (likely(c->is_http11)) { |
|
740
|
355 |
141 |
if (!c->is_keepalive) { |
|
743
|
1 |
15 |
} else if (c->is_keepalive) { |
|
747
|
59 |
453 |
if (streaming) { |
|
748
|
50 |
9 |
if (c->is_http11 && !has_content_length && c->auto_cl) { |
|
|
41 |
9 |
if (c->is_http11 && !has_content_length && c->auto_cl) { |
|
|
40 |
1 |
if (c->is_http11 && !has_content_length && c->auto_cl) { |
|
776
|
59 |
453 |
if (streaming) |
|
787
|
0 |
453 |
if (c->responding != RESPOND_NORMAL) |
|
818
|
0 |
453 |
if (!SvOK(body)) { |
|
822
|
334 |
119 |
else if (SvROK(body)) { |
|
824
|
175 |
159 |
if (SvOK(refd) && !SvROK(refd)) { |
|
|
175 |
0 |
if (SvOK(refd) && !SvROK(refd)) { |
|
828
|
0 |
159 |
else if (SvTYPE(refd) != SVt_PVAV) { |
|
838
|
294 |
159 |
if (body_is_string) { |
|
842
|
140 |
19 |
if (av_len(abody) == 0) { |
|
844
|
140 |
0 |
if (elem) body_scalar = elem; |
|
853
|
449 |
4 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
|
16 |
433 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
|
0 |
433 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
860
|
433 |
0 |
if (unlikely(!hdr_sv || SvREADONLY(hdr_sv))) |
|
|
0 |
433 |
if (unlikely(!hdr_sv || SvREADONLY(hdr_sv))) |
|
869
|
431 |
2 |
if (likely(body_len <= 4096)) { |
|
872
|
431 |
0 |
SvGROW(hdr_sv, total + 1); |
|
|
431 |
0 |
SvGROW(hdr_sv, total + 1); |
|
882
|
2 |
0 |
SvGROW(hdr_sv, hdr_cur + cl_len + 1); |
|
|
2 |
0 |
SvGROW(hdr_sv, hdr_cur + cl_len + 1); |
|
896
|
16 |
4 |
if (likely(c->auto_cl)) |
|
903
|
4 |
16 |
if (unlikely(!c->auto_cl)) { |
|
906
|
0 |
16 |
else if (body_is_string) { |
|
914
|
35 |
16 |
for (I32 i = 0; i <= amax; i++) { |
|
916
|
1 |
34 |
if (unlikely(!sv)) continue; |
|
923
|
16 |
4 |
if (likely(c->auto_cl)) { |
|
943
|
0 |
16 |
PUSHMARK(SP); |
|
944
|
0 |
16 |
mXPUSHs(newSVsv(ERRSV)); |
|
|
16 |
0 |
mXPUSHs(newSVsv(ERRSV)); |
|
950
|
16 |
0 |
sv_setsv(ERRSV, &PL_sv_undef); |
|
959
|
0 |
17 |
PUSHMARK(SP); |
|
960
|
0 |
17 |
mXPUSHs(feer_conn_2sv(c)); |
|
961
|
0 |
17 |
XPUSHs(streamer); |
|
965
|
17 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
1 |
16 |
if (unlikely(SvTRUE(ERRSV))) { |
|
969
|
17 |
0 |
FREETMPS; |
|
977
|
96 |
0 |
if (unlikely(!SvOK(ret) || !SvROK(ret))) { |
|
|
0 |
96 |
if (unlikely(!SvOK(ret) || !SvROK(ret))) { |
|
978
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI response (expected reference)"); |
|
983
|
96 |
0 |
if (unlikely(!IsArrayRef(ret))) { |
|
|
17 |
79 |
if (unlikely(!IsArrayRef(ret))) { |
|
984
|
17 |
0 |
if (likely(can_recurse)) { |
|
989
|
0 |
0 |
sv_setpvs(ERRSV, "PSGI attempt to recurse in a streaming callback"); |
|
996
|
0 |
79 |
if (unlikely(av_len(psgi_triplet)+1 != 3)) { |
|
997
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI array response (expected triplet)"); |
|
1007
|
79 |
0 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
0 |
79 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
79 |
0 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
0 |
79 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
1008
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI array response (NULL element)"); |
|
1017
|
79 |
0 |
if (IsArrayRef(hdrs)) |
|
|
79 |
0 |
if (IsArrayRef(hdrs)) |
|
1020
|
0 |
0 |
sv_setpvs(ERRSV, "PSGI Headers must be an array-ref"); |
|
1030
|
79 |
0 |
if (unlikely(!SvOK(msg) || !(SvIOK(msg) || SvPOK(msg)))) { |
|
|
1 |
78 |
if (unlikely(!SvOK(msg) || !(SvIOK(msg) || SvPOK(msg)))) { |
|
|
0 |
1 |
if (unlikely(!SvOK(msg) || !(SvIOK(msg) || SvPOK(msg)))) { |
|
|
0 |
79 |
if (unlikely(!SvOK(msg) || !(SvIOK(msg) || SvPOK(msg)))) { |
|
1031
|
0 |
0 |
sv_setpvs(ERRSV, "PSGI status must be a number or status string"); |
|
1035
|
1 |
78 |
if (unlikely((av_len(headers) + 1) % 2 == 1)) { |
|
1036
|
1 |
0 |
sv_setpvs(ERRSV, "PSGI headers must be an even-length array"); |
|
1040
|
1 |
77 |
if (SvPOK(msg) && !SvIOK(msg)) { |
|
|
1 |
0 |
if (SvPOK(msg) && !SvIOK(msg)) { |
|
1043
|
0 |
1 |
if (grok_number(SvPVX_const(msg), mlen > 3 ? 3 : mlen, &code) != IS_NUMBER_IN_UV |
|
1044
|
0 |
0 |
|| code == 0) |
|
1046
|
1 |
0 |
sv_setpvs(ERRSV, "PSGI status must start with a positive number"); |
|
1053
|
1 |
76 |
if (unlikely(err)) { |
|
1054
|
1 |
0 |
sv_setpv(ERRSV, err); |
|
1060
|
76 |
0 |
if (likely(IsArrayRef(body))) { |
|
|
71 |
5 |
if (likely(IsArrayRef(body))) { |
|
1064
|
5 |
0 |
else if (likely(SvROK(body))) { // probably an IO::Handle-like object |
|
1080
|
0 |
0 |
sv_setpvs(ERRSV, "Expected PSGI array-ref or IO::Handle-like body"); |
|
1090
|
54 |
7 |
if (is_writer) { |
|
1092
|
1 |
53 |
if (c->poll_write_cb) { |
|
1106
|
54 |
0 |
if (c->responding < RESPOND_SHUTDOWN) { |
|
1115
|
0 |
7 |
if (c->poll_read_cb) { |
|
1120
|
1 |
6 |
if (c->rbuf) { |
|
1124
|
7 |
0 |
if (c->fd >= 0 |
|
1143
|
4 |
2 |
if (guard) { |
|
1145
|
4 |
0 |
c->ext_guard = SvOK(guard) ? newSVsv(guard) : NULL; |
|
1147
|
6 |
0 |
return c->ext_guard ? newSVsv(c->ext_guard) : &PL_sv_undef; |
|
1165
|
0 |
548 |
PUSHMARK(SP); |
|
1167
|
93 |
455 |
if (server->request_cb_is_psgi) { |
|
1169
|
0 |
93 |
mXPUSHs(newRV_noinc((SV*)env)); |
|
1173
|
0 |
455 |
mXPUSHs(feer_conn_2sv(c)); |
|
1183
|
548 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
12 |
536 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1189
|
93 |
455 |
if (server->request_cb_is_psgi && likely(returned >= 1)) { |
|
|
93 |
0 |
if (server->request_cb_is_psgi && likely(returned >= 1)) { |
|
1197
|
93 |
455 |
if (psgi_response) { |
|
1205
|
548 |
0 |
FREETMPS; |
|
1215
|
24 |
2 |
SV *cb = (is_write) ? c->poll_write_cb : c->poll_read_cb; |
|
1217
|
0 |
26 |
if (unlikely(cb == NULL)) return; |
|
1226
|
0 |
26 |
PUSHMARK(SP); |
|
1228
|
0 |
26 |
mXPUSHs(hdl); |
|
1236
|
26 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
26 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1237
|
0 |
0 |
call_died(aTHX_ c, is_write ? "write poll" : "read poll"); |
|
1245
|
26 |
0 |
if (SvUVX(inner)) { |
|
1253
|
26 |
0 |
FREETMPS; |
|
1265
|
0 |
11 |
if (unlikely(c->poll_write_cb == NULL)) return; |
|
1272
|
11 |
0 |
SvREFCNT_inc_simple_void(old_rs); |
|
1279
|
0 |
11 |
PUSHMARK(SP); |
|
1280
|
0 |
11 |
XPUSHs(c->poll_write_cb); |
|
1288
|
11 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
11 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1295
|
0 |
0 |
if (c->poll_write_cb) { |
|
1304
|
11 |
0 |
if (returned > 0) |
|
1306
|
11 |
0 |
if (ret && SvMAGICAL(ret)) |
|
|
0 |
11 |
if (ret && SvMAGICAL(ret)) |
|
1309
|
11 |
0 |
if (unlikely(!ret || !SvOK(ret))) { |
|
|
5 |
6 |
if (unlikely(!ret || !SvOK(ret))) { |
|
1311
|
0 |
5 |
PUSHMARK(SP); |
|
1312
|
0 |
5 |
XPUSHs(c->poll_write_cb); |
|
1317
|
5 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
5 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1318
|
0 |
0 |
trouble("Couldn't close body IO handle: %-p",ERRSV); |
|
1319
|
0 |
0 |
sv_setsv(ERRSV, &PL_sv_undef); |
|
1331
|
6 |
0 |
if (c->use_chunked) |
|
1346
|
11 |
0 |
FREETMPS; |
|
1419
|
0 |
9 |
if (c->tls) { |
|
1421
|
0 |
0 |
if (!c->tls_tunnel) { |
|
1428
|
0 |
0 |
PUSHMARK(SP); |
|
1429
|
0 |
0 |
XPUSHs(sv); |
|
1430
|
0 |
0 |
mXPUSHs(newSViv(c->tls_tunnel_sv1)); |
|
1436
|
0 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1449
|
0 |
0 |
FREETMPS; |
|
1458
|
0 |
9 |
PUSHMARK(SP); |
|
1459
|
0 |
9 |
XPUSHs(sv); |
|
1460
|
0 |
9 |
mXPUSHs(newSViv(c->fd)); |
|
1466
|
9 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
9 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1476
|
9 |
0 |
if (likely(c->rbuf && SvOK(c->rbuf) && SvCUR(c->rbuf))) { |
|
|
9 |
0 |
if (likely(c->rbuf && SvOK(c->rbuf) && SvCUR(c->rbuf))) { |
|
|
9 |
0 |
if (likely(c->rbuf && SvOK(c->rbuf) && SvCUR(c->rbuf))) { |
|
|
9 |
0 |
if (likely(c->rbuf && SvOK(c->rbuf) && SvCUR(c->rbuf))) { |
|
1480
|
0 |
9 |
if (unlikely(!io)) { |
|
1489
|
9 |
0 |
if (likely(pushed == (SSize_t)rbuf_len)) { |
|
1491
|
0 |
0 |
} else if (pushed > 0) { |
|
1510
|
9 |
0 |
FREETMPS; |