Flush bad write data from the client socket.

If the client makes a write that's out of range, by the time we get to
validate the message at the server end the client has already stuffed
the socket with data we can't use, so we have to flush it.

This patch also fixes a potential problem in the acceptance tests where
the error field was being returned as an array rather than a value.
This commit is contained in:
Alex Young
2012-07-15 23:19:12 +01:00
parent f5850e5aaf
commit d0b39cce08
4 changed files with 78 additions and 6 deletions

View File

@@ -27,6 +27,9 @@ int readloop(int filedes, void *buffer, size_t size);
*/
int sendfileloop(int out_fd, int in_fd, off64_t *offset, size_t count);
/** Repeat a splice() operation until we have 'len' bytes. */
ssize_t spliceloop(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags2);
/** Copy ''len'' bytes from ''fd_in'' to ''fd_out'' by creating a temporary
* pipe and using the Linux splice call repeatedly until it has transferred
* all the data. Returns -1 on error.