Diffstat (limited to 'src/daemon/connection.c')
1 files changed, 36 insertions, 2 deletions
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index eb97c6b9..21768b5a 100644
@@ -1,6 +1,6 @@
This file is part of libmicrohttpd
- (C) 2007 Daniel Pittman and Christian Grothoff
+ (C) 2007, 2008 Daniel Pittman and Christian Grothoff
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -82,6 +82,18 @@
#define REQUEST_MALFORMED ""
+ * Response text used when there is an internal server error.
+ * Intentionally empty here to keep our memory footprint
+ * minimal.
+#define INTERNAL_ERROR "<html><head><title>Internal server error</title></head><body>Some programmer needs to study the manual more carefully.</body></html>"
+#define INTERNAL_ERROR ""
#define EXTRA_CHECKS MHD_YES
@@ -676,7 +688,29 @@ MHD_connection_get_fdset (struct MHD_Connection *connection,
if (connection->read_buffer_offset == connection->read_buffer_size)
- try_grow_read_buffer (connection);
+ if ((MHD_YES != try_grow_read_buffer (connection)) &&
+ (0 != (connection->daemon->options &
+ (MHD_USE_SELECT_INTERNALLY |
+ /* failed to grow the read buffer, and the
+ client which is supposed to handle the
+ received data in a *blocking* fashion
+ (in this mode) did not handle the data as
+ it was supposed to!
+ => we would either have to do busy-waiting
+ (on the client, which would likely fail),
+ or if we do nothing, we would just timeout
+ on the connection (if a timeout is even
+ Solution: we kill the connection with an error */
+ transmit_error_response (connection,
if ((connection->read_buffer_offset < connection->read_buffer_size)
&& (MHD_NO == connection->read_closed))
do_fd_set (fd, read_fd_set, max_fd);