| line |
true |
false |
branch |
|
67
|
357 |
27 |
while (buf < end) { |
|
71
|
6 |
71 |
if (*buf & 0x80) { |
|
90
|
3 |
3 |
if (p->namelen > (int)sizeof(p->namebuf)) return NULL; |
|
93
|
6 |
68 |
if (*buf & 0x80) { |
|
98
|
62 |
6 |
p->state = p->namelen ? FUFC_N0 : FUFC_INIT; |
|
103
|
3 |
3 |
if (p->vallen) return NULL; /* Let's just disallow param values > 64 KiB */ |
|
115
|
56 |
9 |
if (p->namelen <= end - buf) { |
|
128
|
6 |
105 |
if (p->namerd == p->namelen) { |
|
140
|
4 |
443 |
if ((int)sizeof(ctx->buf) - ctx->off < len) { |
|
145
|
65 |
441 |
while (ctx->len - ctx->off < len) { |
|
147
|
6 |
59 |
if (r <= 0) return r == 0 ? FUFE_EOF : FUFE_IO; |
|
|
6 |
0 |
if (r <= 0) return r == 0 ? FUFE_EOF : FUFE_IO; |
|
155
|
6 |
222 |
if ((r = fufcgi_fill(ctx, 8)) != FUFE_OK) return r; |
|
157
|
3 |
219 |
if (ctx->buf[ctx->off] != 1) return FUFE_PROTO; /* version */ |
|
164
|
0 |
219 |
if ((r = fufcgi_fill(ctx, rec->len + pad)) != FUFE_OK) return r; |
|
180
|
31 |
25 |
while (len > 0) { |
|
182
|
6 |
25 |
if (r <= 0) return FUFE_SEND; |
|
196
|
12 |
3 |
while (param < end) { |
|
197
|
0 |
12 |
if ((param = fufcgi_param_parse(&p, param, end)) == NULL) return FUFE_PLEN; |
|
198
|
0 |
12 |
if (p.state != FUFC_INIT) return FUFE_PROTO; |
|
199
|
0 |
12 |
if (p.vallen > end - param) return FUFE_PROTO; |
|
200
|
0 |
12 |
if (reslen >= 100) return FUFE_PROTO; /* implies requested params were duplicated */ |
|
202
|
3 |
9 |
if (p.namelen == 14 && memcmp(p.name, "FCGI_MAX_CONNS", 14) == 0) { |
|
|
3 |
0 |
if (p.namelen == 14 && memcmp(p.name, "FCGI_MAX_CONNS", 14) == 0) { |
|
208
|
3 |
6 |
} else if (p.namelen == 13 && memcmp(p.name, "FCGI_MAX_REQS", 13) == 0) { |
|
|
3 |
0 |
} else if (p.namelen == 13 && memcmp(p.name, "FCGI_MAX_REQS", 13) == 0) { |
|
214
|
3 |
3 |
} else if (p.namelen == 15 && memcmp(p.name, "FCGI_MPXS_CONNS", 15) == 0) { |
|
|
3 |
0 |
} else if (p.namelen == 15 && memcmp(p.name, "FCGI_MPXS_CONNS", 15) == 0) { |
|
232
|
9 |
219 |
if ((r = fufcgi_read_record(ctx, rec)) != FUFE_OK) return r == FUFE_EOF && ctx->len == 0 ? FUFE_NOREQ : r; |
|
|
6 |
3 |
if ((r = fufcgi_read_record(ctx, rec)) != FUFE_OK) return r == FUFE_EOF && ctx->len == 0 ? FUFE_NOREQ : r; |
|
|
3 |
3 |
if ((r = fufcgi_read_record(ctx, rec)) != FUFE_OK) return r == FUFE_EOF && ctx->len == 0 ? FUFE_NOREQ : r; |
|
238
|
0 |
157 |
if (rec->id != ctx->reqid) return FUFE_PROTO; |
|
241
|
56 |
0 |
if (!rec->id || rec->id == ctx->reqid) return FUFE_PROTO; |
|
|
0 |
56 |
if (!rec->id || rec->id == ctx->reqid) return FUFE_PROTO; |
|
242
|
0 |
56 |
if (rec->len != 8) return FUFE_PROTO; |
|
244
|
56 |
0 |
if (rec->data[0] != 0 || rec->data[1] != 1) { /* FCGI_RESPONDER */ |
|
|
6 |
50 |
if (rec->data[0] != 0 || rec->data[1] != 1) { /* FCGI_RESPONDER */ |
|
248
|
3 |
3 |
if ((r = fufcgi_write_record(ctx, rec, tmp)) != FUFE_OK) return r; |
|
249
|
0 |
3 |
if (!ctx->keepconn) return FUFE_EOF; |
|
250
|
3 |
47 |
} else if (ctx->reqid) { |
|
254
|
0 |
3 |
if ((r = fufcgi_write_record(ctx, rec, tmp)) != FUFE_OK) return r; |
|
255
|
0 |
3 |
if (!ctx->keepconn) return FUFE_EOF; |
|
261
|
0 |
3 |
if (rec->id) return FUFE_PROTO; |
|
262
|
0 |
3 |
if ((r = fufcgi_handle_values(ctx, rec, tmp)) != FUFE_OK) return r; |
|
270
|
0 |
3 |
if ((r = fufcgi_write_record(ctx, rec, tmp)) != FUFE_OK) return r; |
|
286
|
12 |
112 |
if ((r = fufcgi_read_req_record(ctx, rec)) != FUFE_OK) return r; |
|
287
|
3 |
109 |
if (rec->type == FCGI_ABORT_REQUEST) return FUFE_OK; |
|
288
|
3 |
106 |
if (rec->type != FCGI_PARAMS) return FUFE_PROTO; |
|
289
|
32 |
74 |
if (rec->len == 0) return p.state != FUFC_INIT || valleft ? FUFE_PROTO : FUFE_OK; |
|
|
29 |
3 |
if (rec->len == 0) return p.state != FUFC_INIT || valleft ? FUFE_PROTO : FUFE_OK; |
|
|
3 |
26 |
if (rec->len == 0) return p.state != FUFC_INIT || valleft ? FUFE_PROTO : FUFE_OK; |
|
293
|
133 |
44 |
while (buf < end) { |
|
294
|
50 |
83 |
if (valleft) { |
|
296
|
41 |
9 |
if (val) { |
|
302
|
41 |
9 |
if (val && !valleft) { |
|
|
35 |
6 |
if (val && !valleft) { |
|
308
|
6 |
77 |
if ((buf = fufcgi_param_parse(&p, buf, end)) == NULL) return FUFE_PLEN; |
|
309
|
24 |
53 |
if (p.state != FUFC_INIT) break; |
|
318
|
47 |
6 |
if (p.namelen > 5 && memcmp(p.name, "HTTP_", 5) == 0) { |
|
|
12 |
35 |
if (p.namelen > 5 && memcmp(p.name, "HTTP_", 5) == 0) { |
|
321
|
99 |
12 |
for (r=0; r
|
|
322
|
90 |
9 |
p.name[r] = p.name[r] == '_' ? '-' : p.name[r] >= 'A' && p.name[r] <= 'Z' ? p.name[r] | 0x20 : p.name[r]; |
|
|
90 |
0 |
p.name[r] = p.name[r] == '_' ? '-' : p.name[r] >= 'A' && p.name[r] <= 'Z' ? p.name[r] | 0x20 : p.name[r]; |
|
|
87 |
3 |
p.name[r] = p.name[r] == '_' ? '-' : p.name[r] >= 'A' && p.name[r] <= 'Z' ? p.name[r] | 0x20 : p.name[r]; |
|
323
|
6 |
6 |
if (!(p.namelen == 14 && memcmp(p.name, "content-length", 14) == 0) |
|
|
0 |
6 |
if (!(p.namelen == 14 && memcmp(p.name, "content-length", 14) == 0) |
|
324
|
0 |
6 |
&& !(p.namelen == 12 && memcmp(p.name, "content-type", 12) == 0)) { |
|
|
0 |
0 |
&& !(p.namelen == 12 && memcmp(p.name, "content-type", 12) == 0)) { |
|
329
|
20 |
21 |
} else if (p.namelen == 14 && memcmp(p.name, "CONTENT_LENGTH", 14) == 0) { |
|
|
17 |
3 |
} else if (p.namelen == 14 && memcmp(p.name, "CONTENT_LENGTH", 14) == 0) { |
|
333
|
9 |
15 |
} else if (p.namelen == 12 && memcmp(p.name, "CONTENT_TYPE", 12) == 0) { |
|
|
6 |
3 |
} else if (p.namelen == 12 && memcmp(p.name, "CONTENT_TYPE", 12) == 0) { |
|
337
|
6 |
12 |
} else if (p.namelen == 11 && memcmp(p.name, "REMOTE_ADDR", 11) == 0) { |
|
|
3 |
3 |
} else if (p.namelen == 11 && memcmp(p.name, "REMOTE_ADDR", 11) == 0) { |
|
341
|
3 |
12 |
} else if (p.namelen == 12 && memcmp(p.name, "QUERY_STRING", 12) == 0) { |
|
|
3 |
0 |
} else if (p.namelen == 12 && memcmp(p.name, "QUERY_STRING", 12) == 0) { |
|
345
|
3 |
9 |
} else if (p.namelen == 14 && memcmp(p.name, "REQUEST_METHOD", 14) == 0) { |
|
|
3 |
0 |
} else if (p.namelen == 14 && memcmp(p.name, "REQUEST_METHOD", 14) == 0) { |
|
351
|
3 |
6 |
} else if (p.namelen == 11 && memcmp(p.name, "REQUEST_URI", 11) == 0) { |
|
|
3 |
0 |
} else if (p.namelen == 11 && memcmp(p.name, "REQUEST_URI", 11) == 0) { |
|
357
|
41 |
12 |
if (valsv) { |
|
367
|
0 |
56 |
if (ctx->reqid) fu_confess("Invalid attempt to read FastCGI request before finishing the previous one"); |
|
374
|
27 |
29 |
if ((r = fufcgi_read_params(aTHX_ ctx, &rec)) != FUFE_OK) return r; |
|
378
|
17 |
12 |
if (contentlength && *contentlength) { |
|
|
17 |
0 |
if (contentlength && *contentlength) { |
|
381
|
14 |
3 |
if (*v && !grok_atoUV(v, &uv, NULL)) return FUFE_CLEN; |
|
|
0 |
14 |
if (*v && !grok_atoUV(v, &uv, NULL)) return FUFE_CLEN; |
|
382
|
0 |
17 |
if (uv >= INT_MAX) return FUFE_CLEN; |
|
393
|
3 |
71 |
if (rec.type == FCGI_ABORT_REQUEST) return FUFE_ABORT; |
|
394
|
26 |
45 |
else if (rec.type == FCGI_PARAMS) { |
|
395
|
0 |
26 |
if (rec.len != 0) return FUFE_PROTO; |
|
396
|
45 |
0 |
} else if (rec.type == FCGI_STDIN) { |
|
397
|
26 |
19 |
if (rec.len == 0) { |
|
400
|
23 |
3 |
return stdinleft == 0 ? FUFE_OK : FUFE_ABORT; |
|
402
|
0 |
19 |
if (rec.len > stdinleft) return FUFE_PROTO; |
|
409
|
0 |
45 |
if ((r = fufcgi_read_req_record(ctx, &rec)) != FUFE_OK) return r; |
|
415
|
5 |
3 |
if (ctx->len > 0) { |
|
419
|
0 |
5 |
if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK) |
|
427
|
12 |
11 |
while (len > 0) { |
|
433
|
1 |
11 |
if (ctx->len >= FUFCGI_MAX_DATA) fufcgi_flush(aTHX_ ctx); |
|
444
|
3 |
4 |
if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK) |
|
450
|
0 |
4 |
if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK) |