-------------------------------------------------------------------------*\ * Reads everything until the connection is closed (buffered) \*-------------------------------------------------------------------------*/
| 203 | * Reads everything until the connection is closed (buffered) |
| 204 | \*-------------------------------------------------------------------------*/ |
| 205 | static int recvall(p_buffer buf, luaL_Buffer *b) { |
| 206 | int err = IO_DONE; |
| 207 | size_t total = 0; |
| 208 | while (err == IO_DONE) { |
| 209 | const char *data; size_t count; |
| 210 | err = buffer_get(buf, &data, &count); |
| 211 | total += count; |
| 212 | luaL_addlstring(b, data, count); |
| 213 | buffer_skip(buf, count); |
| 214 | } |
| 215 | if (err == IO_CLOSED) { |
| 216 | if (total > 0) return IO_DONE; |
| 217 | else return IO_CLOSED; |
| 218 | } else return err; |
| 219 | } |
| 220 | |
| 221 | /*-------------------------------------------------------------------------*\ |
| 222 | * Reads a line terminated by a CR LF pair or just by a LF. The CR and LF |
no test coverage detected