aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/connection.c')
-rw-r--r--src/daemon/connection.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index eb97c6b9..21768b5a 100644
--- a/src/daemon/connection.c
+++ b/src/daemon/connection.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of libmicrohttpd 2 This file is part of libmicrohttpd
3 (C) 2007 Daniel Pittman and Christian Grothoff 3 (C) 2007, 2008 Daniel Pittman and Christian Grothoff
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -82,6 +82,18 @@
82#define REQUEST_MALFORMED "" 82#define REQUEST_MALFORMED ""
83#endif 83#endif
84 84
85/**
86 * Response text used when there is an internal server error.
87 *
88 * Intentionally empty here to keep our memory footprint
89 * minimal.
90 */
91#if HAVE_MESSAGES
92#define INTERNAL_ERROR "<html><head><title>Internal server error</title></head><body>Some programmer needs to study the manual more carefully.</body></html>"
93#else
94#define INTERNAL_ERROR ""
95#endif
96
85#define EXTRA_CHECKS MHD_YES 97#define EXTRA_CHECKS MHD_YES
86 98
87#if EXTRA_CHECKS 99#if EXTRA_CHECKS
@@ -676,7 +688,29 @@ MHD_connection_get_fdset (struct MHD_Connection *connection,
676 break; 688 break;
677 case MHD_CONNECTION_CONTINUE_SENT: 689 case MHD_CONNECTION_CONTINUE_SENT:
678 if (connection->read_buffer_offset == connection->read_buffer_size) 690 if (connection->read_buffer_offset == connection->read_buffer_size)
679 try_grow_read_buffer (connection); 691 {
692 if ((MHD_YES != try_grow_read_buffer (connection)) &&
693 (0 != (connection->daemon->options &
694 (MHD_USE_SELECT_INTERNALLY |
695 MHD_USE_THREAD_PER_CONNECTION))))
696 {
697 /* failed to grow the read buffer, and the
698 client which is supposed to handle the
699 received data in a *blocking* fashion
700 (in this mode) did not handle the data as
701 it was supposed to!
702 => we would either have to do busy-waiting
703 (on the client, which would likely fail),
704 or if we do nothing, we would just timeout
705 on the connection (if a timeout is even
706 set!).
707 Solution: we kill the connection with an error */
708 transmit_error_response (connection,
709 MHD_HTTP_INTERNAL_SERVER_ERROR,
710 INTERNAL_ERROR);
711 continue;
712 }
713 }
680 if ((connection->read_buffer_offset < connection->read_buffer_size) 714 if ((connection->read_buffer_offset < connection->read_buffer_size)
681 && (MHD_NO == connection->read_closed)) 715 && (MHD_NO == connection->read_closed))
682 do_fd_set (fd, read_fd_set, max_fd); 716 do_fd_set (fd, read_fd_set, max_fd);