Browse Source

Do not rely on ioctl FIONREAD (#673)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2317 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.21
Stefan Bühler 13 years ago
parent
commit
80a2ff3f3a
  1. 1
      NEWS
  2. 14
      src/connections.c

1
NEWS

@ -7,6 +7,7 @@ NEWS
* Fix base64 decoding in mod_auth (#1757, thx guido)
* Fix mod_cgi segfault when bound to unix domain socket (#653)
* Do not rely on ioctl FIONREAD (#673)
- 1.4.20 - 2008-09-30

14
src/connections.c

@ -330,15 +330,13 @@ static int connection_handle_read(server *srv, connection *con) {
buffer_prepare_copy(b, 4 * 1024);
len = recv(con->fd, b->ptr, b->size - 1, 0);
#else
if (ioctl(con->fd, FIONREAD, &toread)) {
log_error_write(srv, __FILE__, __LINE__, "sd",
"unexpected end-of-file:",
con->fd);
return -1;
if (ioctl(con->fd, FIONREAD, &toread) || toread == 0) {
b = chunkqueue_get_append_buffer(con->read_queue);
buffer_prepare_copy(b, 4 * 1024);
} else {
b = chunkqueue_get_append_buffer(con->read_queue);
buffer_prepare_copy(b, toread + 1);
}
b = chunkqueue_get_append_buffer(con->read_queue);
buffer_prepare_copy(b, toread + 1);
len = read(con->fd, b->ptr, b->size - 1);
#endif

Loading…
Cancel
Save