| 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 |
275 |
if (c->tls) return newSVpvs("https"); |
|
74
|
2 |
273 |
if (c->proxy_ssl) return newSVpvs("https"); |
|
75
|
27 |
246 |
if (c->proxy_proto_version > 0 && c->proxy_dst_port == 443) |
|
|
5 |
22 |
if (c->proxy_proto_version > 0 && c->proxy_dst_port == 443) |
|
77
|
17 |
251 |
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 |
246 |
if (unlikely(!psgi_env_version)) |
|
136
|
303 |
0 |
hv_stores(e, "SERVER_NAME", |
|
138
|
303 |
0 |
hv_stores(e, "SERVER_PORT", |
|
156
|
13 |
290 |
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
|
255 |
48 |
hv_stores(e, "psgi.url_scheme", scheme ? scheme : newSVpvs("http")); |
|
175
|
0 |
303 |
hv_stores(e, "psgi.multiprocess", |
|
|
0 |
303 |
hv_stores(e, "psgi.multiprocess", |
|
178
|
96 |
207 |
if (c->cached_request_cb_is_psgi && c->server->psgix_io) { |
|
|
95 |
1 |
if (c->cached_request_cb_is_psgi && c->server->psgix_io) { |
|
185
|
0 |
303 |
if (c->trailers) { |
|
189
|
2 |
301 |
if (c->proxy_tlvs) { |
|
193
|
302 |
1 |
if (likely(!r->path)) feersum_set_path_and_query(aTHX_ r); |
|
199
|
860 |
303 |
for (i=0; inum_headers; i++) { |
|
218
|
0 |
807 |
if (unlikely(hdr->name_len > MAX_HEADER_NAME_LEN)) { |
|
226
|
6798 |
807 |
for (j=0; jname_len; j++) { |
|
236
|
0 |
807 |
if (unlikely(fetched == NULL)) { |
|
241
|
2 |
805 |
if (unlikely(SvPOK(cur_val))) { |
|
244
|
0 |
2 |
const char *sep = (hdr->name_len == 6 |
|
245
|
0 |
0 |
&& str_case_eq_fixed("cookie", hdr->name, 6)) ? "; " : ", "; |
|
310
|
7 |
0 |
if (r->num_headers > 0) |
|
315
|
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) |
|
317
|
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]) |
|
319
|
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]) |
|
321
|
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]) |
|
323
|
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]) |
|
337
|
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)); |
|
338
|
42 |
10 |
for (size_t i = 0; i < r->num_headers; i++) { |
|
340
|
16 |
26 |
if (unlikely(hdr->name_len == nlen |
|
|
12 |
4 |
if (unlikely(hdr->name_len == nlen |
|
342
|
10 |
2 |
if (likely(!result)) { |
|
345
|
1 |
1 |
sv_catpvn(result, is_cookie ? "; " : ", ", 2); |
|
350
|
10 |
0 |
return result ? result : &PL_sv_undef; |
|
366
|
0 |
12 |
PUSHMARK(SP); |
|
367
|
0 |
12 |
XPUSHs(sv); |
|
368
|
0 |
12 |
mXPUSHs(newSViv(fd)); |
|
374
|
12 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
12 |
if (unlikely(SvTRUE(ERRSV))) { |
|
375
|
0 |
0 |
FREETMPS; LEAVE; |
|
377
|
0 |
0 |
croak("Failed to create %s IO handle: %-p", who, ERRSV); |
|
379
|
0 |
12 |
if (unlikely(!SvROK(sv))) { |
|
380
|
0 |
0 |
FREETMPS; LEAVE; |
|
388
|
12 |
0 |
FREETMPS; |
|
397
|
1 |
12 |
if (unlikely(c->io_taken)) |
|
399
|
0 |
12 |
if (unlikely(c->responding != RESPOND_NOT_STARTED)) |
|
429
|
9 |
3 |
if (c->tls) { |
|
431
|
0 |
9 |
if (!c->tls_tunnel) |
|
449
|
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))) { |
|
453
|
1 |
0 |
if (io) { |
|
455
|
1 |
0 |
if (likely(pushed == (SSize_t)rbuf_len)) { |
|
458
|
0 |
0 |
} else if (pushed > 0) { |
|
486
|
1 |
3 |
if (c->tls_tunnel) |
|
492
|
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))) |
|
496
|
3 |
0 |
IO *io = GvIO(gv); |
|
|
0 |
3 |
IO *io = GvIO(gv); |
|
|
0 |
0 |
IO *io = GvIO(gv); |
|
|
3 |
0 |
IO *io = GvIO(gv); |
|
497
|
3 |
0 |
if (!io || !IoIFP(io)) |
|
|
0 |
3 |
if (!io || !IoIFP(io)) |
|
504
|
0 |
3 |
if (cnt > 0) { |
|
509
|
0 |
0 |
if (ptr) { |
|
511
|
0 |
0 |
if (!c->rbuf) |
|
532
|
3 |
0 |
if (c->rbuf && cnt <= 0) |
|
|
3 |
0 |
if (c->rbuf && cnt <= 0) |
|
550
|
87 |
524 |
if (SvPOK(message)) { |
|
553
|
531 |
85 |
for (STRLEN k = 0; k < mlen; k++) |
|
554
|
530 |
1 |
if (unlikely(mp[k] == '\r' || mp[k] == '\n')) |
|
|
1 |
529 |
if (unlikely(mp[k] == '\r' || mp[k] == '\n')) |
|
559
|
787 |
600 |
for (I32 j = 0; j < avl; j += 2) { |
|
562
|
787 |
0 |
if (!hdr || !SvOK(hdr) || !val || !SvOK(val)) |
|
|
787 |
0 |
if (!hdr || !SvOK(hdr) || !val || !SvOK(val)) |
|
|
787 |
0 |
if (!hdr || !SvOK(hdr) || !val || !SvOK(val)) |
|
|
0 |
787 |
if (!hdr || !SvOK(hdr) || !val || !SvOK(val)) |
|
567
|
9321 |
784 |
for (STRLEN k = 0; k < hlen; k++) |
|
568
|
9320 |
1 |
if (unlikely(hp[k] == '\r' || hp[k] == '\n' || hp[k] == ':')) |
|
|
1 |
9319 |
if (unlikely(hp[k] == '\r' || hp[k] == '\n' || hp[k] == ':')) |
|
|
9319 |
2 |
if (unlikely(hp[k] == '\r' || hp[k] == '\n' || hp[k] == ':')) |
|
|
1 |
9318 |
if (unlikely(hp[k] == '\r' || hp[k] == '\n' || hp[k] == ':')) |
|
570
|
6619 |
778 |
for (STRLEN k = 0; k < vlen; k++) |
|
571
|
6614 |
5 |
if (unlikely(vp[k] == '\r' || vp[k] == '\n')) |
|
|
1 |
6613 |
if (unlikely(vp[k] == '\r' || vp[k] == '\n')) |
|
585
|
531 |
0 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
87 |
444 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
0 |
87 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
0 |
531 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
590
|
0 |
531 |
if (unlikely((avl+1) % 2 == 1)) { |
|
599
|
10 |
521 |
if (unlikely(err)) croak("%s", err); |
|
608
|
4 |
517 |
if (unlikely(c->responding != RESPOND_NOT_STARTED)) |
|
610
|
60 |
457 |
change_responding_state(c, streaming ? RESPOND_STREAMING : RESPOND_NORMAL); |
|
614
|
439 |
78 |
if (SvIOK(message)) |
|
619
|
0 |
78 |
if (unlikely(numtype != IS_NUMBER_IN_UV)) |
|
624
|
0 |
517 |
if (unlikely(!code)) |
|
632
|
78 |
439 |
if (likely(!SvPOK(message) || SvCUR(message) == 3)) { |
|
|
1 |
77 |
if (likely(!SvPOK(message) || SvCUR(message) == 3)) { |
|
651
|
513 |
4 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
|
513 |
0 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
|
511 |
2 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
|
511 |
0 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
|
511 |
0 |
c->auto_cl = http_status_no_body(code) ? 0 : 1; |
|
662
|
668 |
517 |
for (I32 i = 0; i < avl; i += 2) { |
|
665
|
668 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
668 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
668 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
668 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
668 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
668 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
669
|
79 |
589 |
if (unlikely(hlen == 14) && str_case_eq_fixed("content-length", hp, 14)) { |
|
|
79 |
0 |
if (unlikely(hlen == 14) && str_case_eq_fixed("content-length", hp, 14)) { |
|
670
|
78 |
1 |
if (likely(c->auto_cl) && !streaming) |
|
|
69 |
9 |
if (likely(c->auto_cl) && !streaming) |
|
681
|
60 |
457 |
if (streaming && c->is_keepalive && !has_content_length |
|
|
7 |
53 |
if (streaming && c->is_keepalive && !has_content_length |
|
|
6 |
1 |
if (streaming && c->is_keepalive && !has_content_length |
|
682
|
1 |
5 |
&& !c->is_http11 && c->auto_cl) |
|
|
1 |
0 |
&& !c->is_http11 && c->auto_cl) |
|
686
|
501 |
16 |
if (likely(c->is_http11)) |
|
687
|
360 |
141 |
hdr_total += DATE_HEADER_LENGTH + (!c->is_keepalive ? 19 : 0); |
|
688
|
1 |
15 |
else if (c->is_keepalive) |
|
690
|
60 |
457 |
if (streaming) { |
|
691
|
51 |
9 |
if (c->is_http11 && !has_content_length && c->auto_cl) |
|
|
42 |
9 |
if (c->is_http11 && !has_content_length && c->auto_cl) |
|
|
40 |
2 |
if (c->is_http11 && !has_content_length && c->auto_cl) |
|
704
|
501 |
16 |
const char *ver = c->is_http11 ? "HTTP/1.1 " : "HTTP/1.0 "; |
|
710
|
668 |
517 |
for (I32 i = 0; i < avl; i += 2) { |
|
713
|
668 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
668 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
668 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
668 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
668 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
668 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
717
|
79 |
589 |
if (unlikely(hlen == 14) && str_case_eq_fixed("content-length", hp, 14)) { |
|
|
79 |
0 |
if (unlikely(hlen == 14) && str_case_eq_fixed("content-length", hp, 14)) { |
|
718
|
78 |
1 |
if (likely(c->auto_cl) && !streaming) |
|
|
69 |
9 |
if (likely(c->auto_cl) && !streaming) |
|
724
|
0 |
599 |
if (unlikely((p - SvPVX(hdr_sv)) + need > hdr_alloc)) { |
|
727
|
0 |
0 |
SvGROW(hdr_sv, hdr_alloc + 1); |
|
|
0 |
0 |
SvGROW(hdr_sv, hdr_alloc + 1); |
|
737
|
501 |
16 |
if (likely(c->is_http11)) { |
|
739
|
360 |
141 |
if (!c->is_keepalive) { |
|
742
|
1 |
15 |
} else if (c->is_keepalive) { |
|
746
|
60 |
457 |
if (streaming) { |
|
747
|
51 |
9 |
if (c->is_http11 && !has_content_length && c->auto_cl) { |
|
|
42 |
9 |
if (c->is_http11 && !has_content_length && c->auto_cl) { |
|
|
40 |
2 |
if (c->is_http11 && !has_content_length && c->auto_cl) { |
|
775
|
60 |
457 |
if (streaming) |
|
786
|
0 |
457 |
if (c->responding != RESPOND_NORMAL) |
|
817
|
0 |
457 |
if (!SvOK(body)) { |
|
821
|
338 |
119 |
else if (SvROK(body)) { |
|
823
|
176 |
162 |
if (SvOK(refd) && !SvROK(refd)) { |
|
|
176 |
0 |
if (SvOK(refd) && !SvROK(refd)) { |
|
827
|
0 |
162 |
else if (SvTYPE(refd) != SVt_PVAV) { |
|
837
|
295 |
162 |
if (body_is_string) { |
|
841
|
143 |
19 |
if (av_len(abody) == 0) { |
|
843
|
143 |
0 |
if (elem) body_scalar = elem; |
|
852
|
453 |
4 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
|
16 |
437 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
|
0 |
437 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
859
|
437 |
0 |
if (unlikely(!hdr_sv || SvREADONLY(hdr_sv))) |
|
|
0 |
437 |
if (unlikely(!hdr_sv || SvREADONLY(hdr_sv))) |
|
868
|
435 |
2 |
if (likely(body_len <= 4096)) { |
|
871
|
435 |
0 |
SvGROW(hdr_sv, total + 1); |
|
|
435 |
0 |
SvGROW(hdr_sv, total + 1); |
|
881
|
2 |
0 |
SvGROW(hdr_sv, hdr_cur + cl_len + 1); |
|
|
2 |
0 |
SvGROW(hdr_sv, hdr_cur + cl_len + 1); |
|
895
|
16 |
4 |
if (likely(c->auto_cl)) |
|
902
|
4 |
16 |
if (unlikely(!c->auto_cl)) { |
|
905
|
0 |
16 |
else if (body_is_string) { |
|
913
|
35 |
16 |
for (I32 i = 0; i <= amax; i++) { |
|
915
|
1 |
34 |
if (unlikely(!sv)) continue; |
|
922
|
16 |
4 |
if (likely(c->auto_cl)) { |
|
942
|
0 |
16 |
PUSHMARK(SP); |
|
943
|
0 |
16 |
mXPUSHs(newSVsv(ERRSV)); |
|
|
16 |
0 |
mXPUSHs(newSVsv(ERRSV)); |
|
949
|
16 |
0 |
sv_setsv(ERRSV, &PL_sv_undef); |
|
958
|
0 |
17 |
PUSHMARK(SP); |
|
959
|
0 |
17 |
mXPUSHs(feer_conn_2sv(c)); |
|
960
|
0 |
17 |
XPUSHs(streamer); |
|
964
|
17 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
1 |
16 |
if (unlikely(SvTRUE(ERRSV))) { |
|
968
|
17 |
0 |
FREETMPS; |
|
976
|
99 |
0 |
if (unlikely(!SvOK(ret) || !SvROK(ret))) { |
|
|
0 |
99 |
if (unlikely(!SvOK(ret) || !SvROK(ret))) { |
|
977
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI response (expected reference)"); |
|
982
|
99 |
0 |
if (unlikely(!IsArrayRef(ret))) { |
|
|
17 |
82 |
if (unlikely(!IsArrayRef(ret))) { |
|
983
|
17 |
0 |
if (likely(can_recurse)) { |
|
988
|
0 |
0 |
sv_setpvs(ERRSV, "PSGI attempt to recurse in a streaming callback"); |
|
995
|
0 |
82 |
if (unlikely(av_len(psgi_triplet)+1 != 3)) { |
|
996
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI array response (expected triplet)"); |
|
1006
|
82 |
0 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
0 |
82 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
82 |
0 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
0 |
82 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
1007
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI array response (NULL element)"); |
|
1016
|
82 |
0 |
if (IsArrayRef(hdrs)) |
|
|
82 |
0 |
if (IsArrayRef(hdrs)) |
|
1019
|
0 |
0 |
sv_setpvs(ERRSV, "PSGI Headers must be an array-ref"); |
|
1029
|
82 |
0 |
if (unlikely(!SvOK(msg) || !(SvIOK(msg) || SvPOK(msg)))) { |
|
|
1 |
81 |
if (unlikely(!SvOK(msg) || !(SvIOK(msg) || SvPOK(msg)))) { |
|
|
0 |
1 |
if (unlikely(!SvOK(msg) || !(SvIOK(msg) || SvPOK(msg)))) { |
|
|
0 |
82 |
if (unlikely(!SvOK(msg) || !(SvIOK(msg) || SvPOK(msg)))) { |
|
1030
|
0 |
0 |
sv_setpvs(ERRSV, "PSGI status must be a number or status string"); |
|
1034
|
1 |
81 |
if (unlikely((av_len(headers) + 1) % 2 == 1)) { |
|
1035
|
1 |
0 |
sv_setpvs(ERRSV, "PSGI headers must be an even-length array"); |
|
1039
|
1 |
80 |
if (SvPOK(msg) && !SvIOK(msg)) { |
|
|
1 |
0 |
if (SvPOK(msg) && !SvIOK(msg)) { |
|
1042
|
0 |
1 |
if (grok_number(SvPVX_const(msg), mlen > 3 ? 3 : mlen, &code) != IS_NUMBER_IN_UV |
|
1043
|
0 |
0 |
|| code == 0) |
|
1045
|
1 |
0 |
sv_setpvs(ERRSV, "PSGI status must start with a positive number"); |
|
1052
|
1 |
79 |
if (unlikely(err)) { |
|
1053
|
1 |
0 |
sv_setpv(ERRSV, err); |
|
1059
|
79 |
0 |
if (likely(IsArrayRef(body))) { |
|
|
74 |
5 |
if (likely(IsArrayRef(body))) { |
|
1063
|
5 |
0 |
else if (likely(SvROK(body))) { // probably an IO::Handle-like object |
|
1079
|
0 |
0 |
sv_setpvs(ERRSV, "Expected PSGI array-ref or IO::Handle-like body"); |
|
1089
|
55 |
7 |
if (is_writer) { |
|
1091
|
1 |
54 |
if (c->poll_write_cb) { |
|
1105
|
55 |
0 |
if (c->responding < RESPOND_SHUTDOWN) { |
|
1114
|
0 |
7 |
if (c->poll_read_cb) { |
|
1119
|
1 |
6 |
if (c->rbuf) { |
|
1123
|
7 |
0 |
if (c->fd >= 0 |
|
1142
|
4 |
2 |
if (guard) { |
|
1144
|
4 |
0 |
c->ext_guard = SvOK(guard) ? newSVsv(guard) : NULL; |
|
1146
|
6 |
0 |
return c->ext_guard ? newSVsv(c->ext_guard) : &PL_sv_undef; |
|
1164
|
0 |
553 |
PUSHMARK(SP); |
|
1166
|
96 |
457 |
if (server->request_cb_is_psgi) { |
|
1168
|
0 |
96 |
mXPUSHs(newRV_noinc((SV*)env)); |
|
1172
|
0 |
457 |
mXPUSHs(feer_conn_2sv(c)); |
|
1182
|
553 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
12 |
541 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1188
|
96 |
457 |
if (server->request_cb_is_psgi && likely(returned >= 1)) { |
|
|
96 |
0 |
if (server->request_cb_is_psgi && likely(returned >= 1)) { |
|
1196
|
96 |
457 |
if (psgi_response) { |
|
1204
|
553 |
0 |
FREETMPS; |
|
1214
|
24 |
2 |
SV *cb = (is_write) ? c->poll_write_cb : c->poll_read_cb; |
|
1216
|
0 |
26 |
if (unlikely(cb == NULL)) return; |
|
1225
|
0 |
26 |
PUSHMARK(SP); |
|
1227
|
0 |
26 |
mXPUSHs(hdl); |
|
1235
|
26 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
26 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1236
|
0 |
0 |
call_died(aTHX_ c, is_write ? "write poll" : "read poll"); |
|
1244
|
26 |
0 |
if (SvUVX(inner)) { |
|
1252
|
26 |
0 |
FREETMPS; |
|
1264
|
0 |
11 |
if (unlikely(c->poll_write_cb == NULL)) return; |
|
1271
|
11 |
0 |
SvREFCNT_inc_simple_void(old_rs); |
|
1278
|
0 |
11 |
PUSHMARK(SP); |
|
1279
|
0 |
11 |
XPUSHs(c->poll_write_cb); |
|
1287
|
11 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
11 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1294
|
0 |
0 |
if (c->poll_write_cb) { |
|
1303
|
11 |
0 |
if (returned > 0) |
|
1305
|
11 |
0 |
if (ret && SvMAGICAL(ret)) |
|
|
0 |
11 |
if (ret && SvMAGICAL(ret)) |
|
1308
|
11 |
0 |
if (unlikely(!ret || !SvOK(ret))) { |
|
|
5 |
6 |
if (unlikely(!ret || !SvOK(ret))) { |
|
1310
|
0 |
5 |
PUSHMARK(SP); |
|
1311
|
0 |
5 |
XPUSHs(c->poll_write_cb); |
|
1316
|
5 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
5 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1317
|
0 |
0 |
trouble("Couldn't close body IO handle: %-p",ERRSV); |
|
1318
|
0 |
0 |
sv_setsv(ERRSV, &PL_sv_undef); |
|
1330
|
6 |
0 |
if (c->use_chunked) |
|
1345
|
11 |
0 |
FREETMPS; |
|
1418
|
0 |
9 |
if (c->tls) { |
|
1420
|
0 |
0 |
if (!c->tls_tunnel) { |
|
1427
|
0 |
0 |
PUSHMARK(SP); |
|
1428
|
0 |
0 |
XPUSHs(sv); |
|
1429
|
0 |
0 |
mXPUSHs(newSViv(c->tls_tunnel_sv1)); |
|
1435
|
0 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1448
|
0 |
0 |
FREETMPS; |
|
1457
|
0 |
9 |
PUSHMARK(SP); |
|
1458
|
0 |
9 |
XPUSHs(sv); |
|
1459
|
0 |
9 |
mXPUSHs(newSViv(c->fd)); |
|
1465
|
9 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
9 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1475
|
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))) { |
|
1479
|
0 |
9 |
if (unlikely(!io)) { |
|
1488
|
9 |
0 |
if (likely(pushed == (SSize_t)rbuf_len)) { |
|
1490
|
0 |
0 |
} else if (pushed > 0) { |
|
1509
|
9 |
0 |
FREETMPS; |