| 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 |
264 |
if (c->tls) return newSVpvs("https"); |
|
74
|
2 |
262 |
if (c->proxy_ssl) return newSVpvs("https"); |
|
75
|
23 |
239 |
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 |
240 |
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; |
|
88
|
0 |
56 |
if (psgi_env_version) return; // already initialized |
|
131
|
56 |
236 |
if (unlikely(!psgi_env_version)) |
|
144
|
292 |
0 |
hv_stores(e, "SERVER_NAME", |
|
146
|
292 |
0 |
hv_stores(e, "SERVER_PORT", |
|
163
|
13 |
279 |
if (c->cached_use_reverse_proxy) { |
|
165
|
5 |
8 |
hv_stores(e, "REMOTE_ADDR", fwd_addr ? fwd_addr : SvREFCNT_inc_simple_NN(c->remote_addr)); |
|
173
|
244 |
48 |
hv_stores(e, "psgi.url_scheme", scheme ? scheme : newSVpvs("http")); |
|
182
|
88 |
204 |
if (c->cached_request_cb_is_psgi && c->server->psgix_io) { |
|
|
88 |
0 |
if (c->cached_request_cb_is_psgi && c->server->psgix_io) { |
|
189
|
0 |
292 |
if (c->trailers) { |
|
193
|
1 |
291 |
if (c->proxy_tlvs) { |
|
197
|
291 |
1 |
if (likely(!r->path)) feersum_set_path_and_query(aTHX_ r); |
|
204
|
838 |
292 |
for (i=0; inum_headers; i++) { |
|
223
|
0 |
785 |
if (unlikely(hdr->name_len > MAX_HEADER_NAME_LEN)) { |
|
231
|
6644 |
785 |
for (j=0; jname_len; j++) { |
|
241
|
0 |
785 |
if (unlikely(fetched == NULL)) { |
|
246
|
2 |
783 |
if (unlikely(SvPOK(cur_val))) { |
|
249
|
0 |
2 |
const char *sep = (hdr->name_len == 6 |
|
250
|
0 |
0 |
&& str_case_eq_fixed("cookie", hdr->name, 6)) ? "; " : ", "; |
|
315
|
7 |
0 |
if (r->num_headers > 0) |
|
320
|
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) |
|
322
|
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]) |
|
324
|
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]) |
|
326
|
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]) |
|
328
|
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]) |
|
343
|
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)); |
|
344
|
42 |
10 |
for (i = 0; i < r->num_headers; i++) { |
|
346
|
16 |
26 |
if (unlikely(hdr->name_len == nlen |
|
|
12 |
4 |
if (unlikely(hdr->name_len == nlen |
|
348
|
10 |
2 |
if (likely(!result)) { |
|
351
|
1 |
1 |
sv_catpvn(result, is_cookie ? "; " : ", ", 2); |
|
356
|
10 |
0 |
return result ? result : &PL_sv_undef; |
|
371
|
1 |
12 |
if (unlikely(c->io_taken)) |
|
373
|
0 |
12 |
if (unlikely(c->responding != RESPOND_NOT_STARTED)) |
|
436
|
9 |
3 |
if (c->tls) { |
|
438
|
0 |
9 |
if (!c->tls_tunnel) |
|
445
|
0 |
9 |
PUSHMARK(SP); |
|
446
|
0 |
9 |
XPUSHs(sv); |
|
447
|
0 |
9 |
mXPUSHs(newSViv(c->tls_tunnel_sv1)); |
|
453
|
9 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
9 |
if (unlikely(SvTRUE(ERRSV))) { |
|
454
|
0 |
0 |
FREETMPS; |
|
457
|
0 |
0 |
croak("Failed to create TLS tunnel IO handle: %-p", ERRSV); |
|
460
|
0 |
9 |
if (unlikely(!SvROK(sv))) { |
|
463
|
0 |
0 |
FREETMPS; |
|
480
|
9 |
0 |
FREETMPS; |
|
492
|
0 |
3 |
PUSHMARK(SP); |
|
493
|
0 |
3 |
XPUSHs(sv); |
|
494
|
0 |
3 |
mXPUSHs(newSViv(c->fd)); |
|
501
|
3 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
3 |
if (unlikely(SvTRUE(ERRSV))) { |
|
502
|
0 |
0 |
FREETMPS; |
|
505
|
0 |
0 |
croak("Failed to create IO handle: %-p", ERRSV); |
|
509
|
0 |
3 |
if (unlikely(!SvROK(sv))) { |
|
510
|
0 |
0 |
FREETMPS; |
|
521
|
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))) { |
|
525
|
1 |
0 |
if (io) { |
|
527
|
1 |
0 |
if (likely(pushed == (SSize_t)rbuf_len)) { |
|
530
|
0 |
0 |
} else if (pushed > 0) { |
|
549
|
3 |
0 |
FREETMPS; |
|
563
|
1 |
3 |
if (c->tls_tunnel) |
|
569
|
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))) |
|
573
|
3 |
0 |
IO *io = GvIO(gv); |
|
|
0 |
3 |
IO *io = GvIO(gv); |
|
|
0 |
0 |
IO *io = GvIO(gv); |
|
|
3 |
0 |
IO *io = GvIO(gv); |
|
574
|
3 |
0 |
if (!io || !IoIFP(io)) |
|
|
0 |
3 |
if (!io || !IoIFP(io)) |
|
581
|
0 |
3 |
if (cnt > 0) { |
|
586
|
0 |
0 |
if (ptr) { |
|
588
|
0 |
0 |
if (!c->rbuf) |
|
609
|
3 |
0 |
if (c->rbuf && cnt <= 0) |
|
|
3 |
0 |
if (c->rbuf && cnt <= 0) |
|
628
|
513 |
0 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
78 |
435 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
0 |
78 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
|
0 |
513 |
if (unlikely(!SvOK(message) || !(SvIOK(message) || SvPOK(message)))) { |
|
633
|
0 |
513 |
if (unlikely((avl+1) % 2 == 1)) { |
|
644
|
4 |
509 |
if (unlikely(c->responding != RESPOND_NOT_STARTED)) |
|
646
|
59 |
450 |
change_responding_state(c, streaming ? RESPOND_STREAMING : RESPOND_NORMAL); |
|
650
|
431 |
78 |
if (SvIOK(message)) |
|
655
|
0 |
78 |
if (unlikely(numtype != IS_NUMBER_IN_UV)) |
|
660
|
0 |
509 |
if (unlikely(!code)) |
|
668
|
78 |
431 |
if (likely(!SvPOK(message) || SvCUR(message) == 3)) { |
|
|
1 |
77 |
if (likely(!SvPOK(message) || SvCUR(message) == 3)) { |
|
689
|
506 |
0 |
c->auto_cl = (code == 204 || code == 205 || code == 304 || |
|
|
504 |
2 |
c->auto_cl = (code == 204 || code == 205 || code == 304 || |
|
690
|
506 |
3 |
(100 <= code && code <= 199)) ? 0 : 1; |
|
|
504 |
0 |
(100 <= code && code <= 199)) ? 0 : 1; |
|
|
504 |
0 |
(100 <= code && code <= 199)) ? 0 : 1; |
|
701
|
659 |
509 |
for (i=0; i
|
|
704
|
659 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
659 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
659 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
659 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
659 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
659 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
708
|
78 |
581 |
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)) { |
|
709
|
77 |
1 |
if (likely(c->auto_cl) && !streaming) |
|
|
68 |
9 |
if (likely(c->auto_cl) && !streaming) |
|
720
|
59 |
450 |
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 |
|
721
|
1 |
5 |
&& !c->is_http11 && c->auto_cl) |
|
|
1 |
0 |
&& !c->is_http11 && c->auto_cl) |
|
725
|
493 |
16 |
if (likely(c->is_http11)) |
|
726
|
352 |
141 |
hdr_total += DATE_HEADER_LENGTH + (!c->is_keepalive ? 19 : 0); |
|
727
|
1 |
15 |
else if (c->is_keepalive) |
|
729
|
59 |
450 |
if (streaming) { |
|
730
|
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) |
|
743
|
493 |
16 |
const char *ver = c->is_http11 ? "HTTP/1.1 " : "HTTP/1.0 "; |
|
749
|
659 |
509 |
for (i=0; i
|
|
752
|
659 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
659 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
659 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
659 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
659 |
0 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
|
0 |
659 |
if (unlikely(!hdr || !SvOK(hdr) || !val || !SvOK(val))) |
|
756
|
78 |
581 |
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)) { |
|
757
|
77 |
1 |
if (likely(c->auto_cl) && !streaming) |
|
|
68 |
9 |
if (likely(c->auto_cl) && !streaming) |
|
763
|
0 |
591 |
if (unlikely((p - SvPVX(hdr_sv)) + need > hdr_alloc)) { |
|
766
|
0 |
0 |
SvGROW(hdr_sv, hdr_alloc + 1); |
|
|
0 |
0 |
SvGROW(hdr_sv, hdr_alloc + 1); |
|
776
|
493 |
16 |
if (likely(c->is_http11)) { |
|
778
|
352 |
141 |
if (!c->is_keepalive) { |
|
781
|
1 |
15 |
} else if (c->is_keepalive) { |
|
785
|
59 |
450 |
if (streaming) { |
|
786
|
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) { |
|
814
|
59 |
450 |
if (streaming) |
|
826
|
0 |
450 |
if (c->responding != RESPOND_NORMAL) |
|
857
|
0 |
450 |
if (!SvOK(body)) { |
|
861
|
331 |
119 |
else if (SvROK(body)) { |
|
863
|
173 |
158 |
if (SvOK(refd) && !SvROK(refd)) { |
|
|
173 |
0 |
if (SvOK(refd) && !SvROK(refd)) { |
|
867
|
0 |
158 |
else if (SvTYPE(refd) != SVt_PVAV) { |
|
877
|
292 |
158 |
if (body_is_string) { |
|
881
|
139 |
19 |
if (av_len(abody) == 0) { |
|
883
|
139 |
0 |
if (elem) body_scalar = elem; |
|
892
|
446 |
4 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
|
16 |
430 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
|
0 |
430 |
if (likely(c->auto_cl) && body_scalar && c->wbuf_rinq) { |
|
899
|
430 |
0 |
if (unlikely(!hdr_sv || SvREADONLY(hdr_sv))) |
|
|
0 |
430 |
if (unlikely(!hdr_sv || SvREADONLY(hdr_sv))) |
|
908
|
428 |
2 |
if (likely(body_len <= 4096)) { |
|
911
|
428 |
0 |
SvGROW(hdr_sv, total + 1); |
|
|
428 |
0 |
SvGROW(hdr_sv, total + 1); |
|
921
|
2 |
0 |
SvGROW(hdr_sv, hdr_cur + cl_len + 1); |
|
|
2 |
0 |
SvGROW(hdr_sv, hdr_cur + cl_len + 1); |
|
935
|
16 |
4 |
if (likely(c->auto_cl)) |
|
942
|
4 |
16 |
if (unlikely(!c->auto_cl)) { |
|
945
|
0 |
16 |
else if (body_is_string) { |
|
953
|
35 |
16 |
for (i=0; i<=amax; i++) { |
|
955
|
1 |
34 |
if (unlikely(!sv)) continue; |
|
962
|
16 |
4 |
if (likely(c->auto_cl)) { |
|
982
|
0 |
3 |
PUSHMARK(SP); |
|
983
|
0 |
3 |
mXPUSHs(newSVsv(ERRSV)); |
|
|
3 |
0 |
mXPUSHs(newSVsv(ERRSV)); |
|
989
|
3 |
0 |
sv_setsv(ERRSV, &PL_sv_undef); |
|
998
|
0 |
16 |
PUSHMARK(SP); |
|
999
|
0 |
16 |
mXPUSHs(feer_conn_2sv(c)); |
|
1000
|
0 |
16 |
XPUSHs(streamer); |
|
1004
|
16 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
16 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1008
|
16 |
0 |
FREETMPS; |
|
1016
|
91 |
0 |
if (unlikely(!SvOK(ret) || !SvROK(ret))) { |
|
|
0 |
91 |
if (unlikely(!SvOK(ret) || !SvROK(ret))) { |
|
1017
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI response (expected reference)"); |
|
1022
|
91 |
0 |
if (unlikely(!IsArrayRef(ret))) { |
|
|
16 |
75 |
if (unlikely(!IsArrayRef(ret))) { |
|
1023
|
16 |
0 |
if (likely(can_recurse)) { |
|
1028
|
0 |
0 |
sv_setpvs(ERRSV, "PSGI attempt to recurse in a streaming callback"); |
|
1035
|
0 |
75 |
if (unlikely(av_len(psgi_triplet)+1 != 3)) { |
|
1036
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI array response (expected triplet)"); |
|
1046
|
75 |
0 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
0 |
75 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
75 |
0 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
|
0 |
75 |
if (unlikely(!msg_p || !hdrs_p || !body_p)) { |
|
1047
|
0 |
0 |
sv_setpvs(ERRSV, "Invalid PSGI array response (NULL element)"); |
|
1056
|
75 |
0 |
if (IsArrayRef(hdrs)) |
|
|
75 |
0 |
if (IsArrayRef(hdrs)) |
|
1059
|
0 |
0 |
sv_setpvs(ERRSV, "PSGI Headers must be an array-ref"); |
|
1064
|
75 |
0 |
if (likely(IsArrayRef(body))) { |
|
|
70 |
5 |
if (likely(IsArrayRef(body))) { |
|
1068
|
5 |
0 |
else if (likely(SvROK(body))) { // probably an IO::Handle-like object |
|
1084
|
0 |
0 |
sv_setpvs(ERRSV, "Expected PSGI array-ref or IO::Handle-like body"); |
|
1094
|
54 |
7 |
if (is_writer) { |
|
1096
|
1 |
53 |
if (c->poll_write_cb) { |
|
1110
|
54 |
0 |
if (c->responding < RESPOND_SHUTDOWN) { |
|
1119
|
0 |
7 |
if (c->poll_read_cb) { |
|
1124
|
1 |
6 |
if (c->rbuf) { |
|
1128
|
7 |
0 |
if (c->fd >= 0 |
|
1147
|
4 |
2 |
if (guard) { |
|
1148
|
2 |
2 |
if (c->ext_guard) SvREFCNT_dec(c->ext_guard); |
|
1149
|
4 |
0 |
c->ext_guard = SvOK(guard) ? newSVsv(guard) : NULL; |
|
1151
|
6 |
0 |
return c->ext_guard ? newSVsv(c->ext_guard) : &PL_sv_undef; |
|
1169
|
0 |
532 |
PUSHMARK(SP); |
|
1171
|
88 |
444 |
if (server->request_cb_is_psgi) { |
|
1173
|
0 |
88 |
mXPUSHs(newRV_noinc((SV*)env)); |
|
1177
|
0 |
444 |
mXPUSHs(feer_conn_2sv(c)); |
|
1187
|
532 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
3 |
529 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1193
|
88 |
444 |
if (server->request_cb_is_psgi && likely(returned >= 1)) { |
|
|
88 |
0 |
if (server->request_cb_is_psgi && likely(returned >= 1)) { |
|
1201
|
88 |
444 |
if (psgi_response) { |
|
1209
|
532 |
0 |
FREETMPS; |
|
1219
|
24 |
2 |
SV *cb = (is_write) ? c->poll_write_cb : c->poll_read_cb; |
|
1221
|
0 |
26 |
if (unlikely(cb == NULL)) return; |
|
1230
|
0 |
26 |
PUSHMARK(SP); |
|
1232
|
0 |
26 |
mXPUSHs(hdl); |
|
1240
|
26 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
26 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1241
|
0 |
0 |
call_died(aTHX_ c, is_write ? "write poll" : "read poll"); |
|
1249
|
26 |
0 |
if (SvUVX(inner)) { |
|
1257
|
26 |
0 |
FREETMPS; |
|
1269
|
0 |
11 |
if (unlikely(c->poll_write_cb == NULL)) return; |
|
1276
|
11 |
0 |
SvREFCNT_inc_simple_void(old_rs); |
|
1283
|
0 |
11 |
PUSHMARK(SP); |
|
1284
|
0 |
11 |
XPUSHs(c->poll_write_cb); |
|
1292
|
11 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
11 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1299
|
0 |
0 |
if (c->poll_write_cb) { |
|
1308
|
11 |
0 |
if (returned > 0) |
|
1310
|
11 |
0 |
if (ret && SvMAGICAL(ret)) |
|
|
0 |
11 |
if (ret && SvMAGICAL(ret)) |
|
1313
|
11 |
0 |
if (unlikely(!ret || !SvOK(ret))) { |
|
|
5 |
6 |
if (unlikely(!ret || !SvOK(ret))) { |
|
1315
|
0 |
5 |
PUSHMARK(SP); |
|
1316
|
0 |
5 |
XPUSHs(c->poll_write_cb); |
|
1321
|
5 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
5 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1322
|
0 |
0 |
trouble("Couldn't close body IO handle: %-p",ERRSV); |
|
1323
|
0 |
0 |
sv_setsv(ERRSV, &PL_sv_undef); |
|
1335
|
6 |
0 |
if (c->use_chunked) |
|
1350
|
11 |
0 |
FREETMPS; |
|
1423
|
0 |
9 |
if (c->tls) { |
|
1425
|
0 |
0 |
if (!c->tls_tunnel) { |
|
1432
|
0 |
0 |
PUSHMARK(SP); |
|
1433
|
0 |
0 |
XPUSHs(sv); |
|
1434
|
0 |
0 |
mXPUSHs(newSViv(c->tls_tunnel_sv1)); |
|
1440
|
0 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1453
|
0 |
0 |
FREETMPS; |
|
1462
|
0 |
9 |
PUSHMARK(SP); |
|
1463
|
0 |
9 |
XPUSHs(sv); |
|
1464
|
0 |
9 |
mXPUSHs(newSViv(c->fd)); |
|
1470
|
9 |
0 |
if (unlikely(SvTRUE(ERRSV))) { |
|
|
0 |
9 |
if (unlikely(SvTRUE(ERRSV))) { |
|
1480
|
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))) { |
|
1484
|
0 |
9 |
if (unlikely(!io)) { |
|
1493
|
9 |
0 |
if (likely(pushed == (SSize_t)rbuf_len)) { |
|
1495
|
0 |
0 |
} else if (pushed > 0) { |
|
1514
|
9 |
0 |
FREETMPS; |