| line |
true |
false |
branch |
|
9
|
0 |
0 |
for (i = 0; i + 3 <= src_len; i += 3) { |
|
15
|
0 |
0 |
if (i < src_len) { |
|
17
|
0 |
0 |
if (i + 1 == src_len) { |
|
48
|
0 |
0 |
if (self->compress && body_data_len > 0) { |
|
|
0 |
0 |
if (self->compress && body_data_len > 0) { |
|
51
|
0 |
0 |
if (body) { |
|
61
|
0 |
0 |
+ (self->database ? strlen(self->database) * 3 : 0) |
|
62
|
0 |
0 |
+ (self->session_id ? strlen(self->session_id) * 3 : 0) |
|
68
|
0 |
0 |
if (self->database) { |
|
75
|
0 |
0 |
if (self->session_id) { |
|
79
|
0 |
0 |
if (url_sql) { |
|
86
|
0 |
0 |
if (query_id) { |
|
88
|
0 |
0 |
if (need > params_cap) { |
|
101
|
0 |
0 |
+ (self->host ? strlen(self->host) : 0) |
|
102
|
0 |
0 |
+ (self->user ? strlen(self->user) * 2 : 0) |
|
103
|
0 |
0 |
+ (self->password ? strlen(self->password) * 2 : 0); |
|
112
|
0 |
0 |
if (self->http_basic_auth && self->user) { |
|
|
0 |
0 |
if (self->http_basic_auth && self->user) { |
|
115
|
0 |
0 |
size_t pl = self->password ? strlen(self->password) : 0; |
|
122
|
0 |
0 |
if (pl) memcpy(buf + ul + 1, self->password, pl); |
|
128
|
0 |
0 |
if (self->user) |
|
131
|
0 |
0 |
if (self->password && self->password[0]) |
|
|
0 |
0 |
if (self->password && self->password[0]) |
|
136
|
0 |
0 |
if (self->compress) |
|
138
|
0 |
0 |
if (content_encoding) |
|
144
|
0 |
0 |
if (body_len > 0) { |
|
145
|
0 |
0 |
if (pos + body_len > req_cap) { |
|
149
|
0 |
0 |
Copy(body ? body : body_data, req + pos, body_len, char); |
|
153
|
0 |
0 |
if (body) Safefree(body); |
|
162
|
0 |
0 |
size_t req_cap = 128 + (self->host ? strlen(self->host) : 0); |
|
171
|
0 |
0 |
if (pos >= req_cap) pos = req_cap - 1; |
|
185
|
0 |
0 |
for (i = 0; i < len; i++) { |
|
187
|
0 |
0 |
if (c < '0' || c > '9') break; |
|
|
0 |
0 |
if (c < '0' || c > '9') break; |
|
196
|
0 |
0 |
if (len < 4) return 0; |
|
197
|
0 |
0 |
for (i = 0; i <= len - 4; i++) { |
|
198
|
0 |
0 |
if (buf[i] == '\r' && buf[i+1] == '\n' && |
|
|
0 |
0 |
if (buf[i] == '\r' && buf[i+1] == '\n' && |
|
199
|
0 |
0 |
buf[i+2] == '\r' && buf[i+3] == '\n') { |
|
|
0 |
0 |
buf[i+2] == '\r' && buf[i+3] == '\n') { |
|
208
|
0 |
0 |
if (len > 6 && memcmp(body, "Code: ", 6) == 0) |
|
|
0 |
0 |
if (len > 6 && memcmp(body, "Code: ", 6) == 0) |
|
221
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
224
|
0 |
0 |
if (dec) { err_body = dec; err_len = dec_len; } |
|
226
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
232
|
0 |
0 |
if (err_body != body) Safefree(err_body); |
|
244
|
0 |
0 |
while (p < end && *p != ' ') p++; |
|
|
0 |
0 |
while (p < end && *p != ' ') p++; |
|
245
|
0 |
0 |
if (p >= end) return 0; |
|
249
|
0 |
0 |
if (status < 100 || status > 599) return 500; /* treat malformed as server error */ |
|
|
0 |
0 |
if (status < 100 || status > 599) return 500; /* treat malformed as server error */ |
|
260
|
0 |
0 |
while (p < end) { |
|
262
|
0 |
0 |
while (line_end < end && *line_end != '\r') line_end++; |
|
|
0 |
0 |
while (line_end < end && *line_end != '\r') line_end++; |
|
264
|
0 |
0 |
if ((size_t)(line_end - p) > name_len + 1 && p[name_len] == ':') { |
|
|
0 |
0 |
if ((size_t)(line_end - p) > name_len + 1 && p[name_len] == ':') { |
|
267
|
0 |
0 |
for (i = 0; i < name_len; i++) { |
|
268
|
0 |
0 |
if (tolower((unsigned char)p[i]) != tolower((unsigned char)name[i])) { |
|
273
|
0 |
0 |
if (match) { |
|
275
|
0 |
0 |
while (val < line_end && *val == ' ') val++; |
|
|
0 |
0 |
while (val < line_end && *val == ' ') val++; |
|
282
|
0 |
0 |
if (line_end + 2 <= end) p = line_end + 2; |
|
303
|
0 |
0 |
if (self->recv_len == 0 || self->send_count == 0) return; |
|
|
0 |
0 |
if (self->recv_len == 0 || self->send_count == 0) return; |
|
307
|
0 |
0 |
if (hdr_end == 0) return; /* need more data */ |
|
314
|
0 |
0 |
if (val) { |
|
320
|
0 |
0 |
if (val && val_len >= 7 && strncasecmp(val, "chunked", 7) == 0) { |
|
|
0 |
0 |
if (val && val_len >= 7 && strncasecmp(val, "chunked", 7) == 0) { |
|
|
0 |
0 |
if (val && val_len >= 7 && strncasecmp(val, "chunked", 7) == 0) { |
|
326
|
0 |
0 |
if (val && val_len >= 4 && strncasecmp(val, "gzip", 4) == 0) { |
|
|
0 |
0 |
if (val && val_len >= 4 && strncasecmp(val, "gzip", 4) == 0) { |
|
|
0 |
0 |
if (val && val_len >= 4 && strncasecmp(val, "gzip", 4) == 0) { |
|
334
|
0 |
0 |
if (val && val_len > 12) { |
|
|
0 |
0 |
if (val && val_len > 12) { |
|
336
|
0 |
0 |
for (i = 0; i + 12 < val_len; i++) { |
|
337
|
0 |
0 |
if (val[i] != '"') continue; |
|
341
|
0 |
0 |
if (i + 13 < val_len |
|
342
|
0 |
0 |
&& memcmp(val + i + 1, "read_rows\":\"", 12) == 0) |
|
345
|
0 |
0 |
else if (i + 14 < val_len |
|
346
|
0 |
0 |
&& memcmp(val + i + 1, "read_bytes\":\"", 13) == 0) |
|
353
|
0 |
0 |
if (chunked) { |
|
360
|
0 |
0 |
while (cp < cp_end) { |
|
364
|
0 |
0 |
while (nl < cp_end && *nl != '\r') nl++; |
|
|
0 |
0 |
while (nl < cp_end && *nl != '\r') nl++; |
|
365
|
0 |
0 |
if (nl + 2 > cp_end) goto need_more; /* need more data */ |
|
370
|
0 |
0 |
if (chunk_size == 0) { |
|
372
|
0 |
0 |
if (cp + 2 > cp_end) goto need_more; |
|
378
|
0 |
0 |
if ((size_t)(cp_end - cp) < 2 |
|
379
|
0 |
0 |
|| chunk_size > (size_t)(cp_end - cp) - 2) goto need_more; |
|
388
|
0 |
0 |
if (self->max_recv_buffer > 0 |
|
389
|
0 |
0 |
&& self->max_recv_buffer < cap) |
|
391
|
0 |
0 |
if (decoded_len + chunk_size < decoded_len |
|
392
|
0 |
0 |
|| decoded_len + chunk_size > cap) { |
|
393
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
399
|
0 |
0 |
if (decoded == NULL) { |
|
402
|
0 |
0 |
} else if (decoded_len + chunk_size > decoded_cap) { |
|
411
|
0 |
0 |
if (!chunked_complete) goto need_more; |
|
419
|
0 |
0 |
if (self->recv_len < hdr_end + content_length) return; /* need more data */ |
|
427
|
0 |
0 |
if (status == 200) { |
|
431
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
434
|
0 |
0 |
if (!dec) { |
|
435
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
438
|
0 |
0 |
if (destroyed) return; |
|
447
|
0 |
0 |
if (self->max_recv_buffer > 0 |
|
448
|
0 |
0 |
&& dec_len > self->max_recv_buffer) { |
|
450
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
462
|
0 |
0 |
if (is_raw) { |
|
467
|
0 |
0 |
if (final_len > 0) |
|
471
|
0 |
0 |
if (final_body != body) Safefree(final_body); |
|
472
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
474
|
0 |
0 |
if (destroyed) return; |
|
479
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
483
|
0 |
0 |
if (destroyed) return; |
|
486
|
0 |
0 |
if (self->magic != EV_CH_MAGIC) return; |
|
496
|
0 |
0 |
if (decoded) Safefree(decoded); |