| 86 | } |
| 87 | |
| 88 | static int th_send_all(th_sock_t s, const char *data, size_t len) { |
| 89 | size_t off = 0; |
| 90 | while (off < len) { |
| 91 | #ifdef _WIN32 |
| 92 | int n = send(s, data + off, (int)(len - off), 0); |
| 93 | #else |
| 94 | ssize_t n = send(s, data + off, len - off, 0); |
| 95 | #endif |
| 96 | if (n <= 0) |
| 97 | return -1; |
| 98 | off += (size_t)n; |
| 99 | } |
| 100 | return 0; |
| 101 | } |
| 102 | |
| 103 | /* Read until the server closes the connection (Connection: close model). */ |
| 104 | static int th_recv_until_close(th_sock_t s, char *buf, size_t bufsz) { |
no outgoing calls
no test coverage detected