aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2008-04-12 21:16:28 +0000
committerChristian Grothoff <christian@grothoff.org>2008-04-12 21:16:28 +0000
commitec8aedc77bbaa293dc76d2aba98fc8ce1243cf68 (patch)
tree7320c9bcadfd14aef58a63236aa3e6405382bc1a
parenta3a09cb33abca62ec05bd38ae8c84449fd6e6dca (diff)
downloadlibmicrohttpd-ec8aedc77bbaa293dc76d2aba98fc8ce1243cf68.tar.gz
libmicrohttpd-ec8aedc77bbaa293dc76d2aba98fc8ce1243cf68.zip
msgs
-rw-r--r--ChangeLog12
-rw-r--r--src/daemon/connection.c22
-rw-r--r--src/testcurl/daemontest_long_header.c4
3 files changed, 36 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b5fc1d51..c2762c2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
1Sat Apr 12 15:14:05 MDT 2008
2 Restructured the code (curl-testcases and zzuf testcases
3 are now in different directories; code examples are in
4 src/examples/).
5 Fixed a problem (introduced in 0.2.3) with handling very
6 large requests (the code did not return proper error code).
7 If "--enable-messages" is specified, the code now includes
8 reasonable default HTML webpages for various build-in
9 errors (such as request too large and malformed requests).
10 Without that flag, the webpages returned will still be
11 empty.
12
1Fri Apr 11 20:20:34 MDT 2008 13Fri Apr 11 20:20:34 MDT 2008
2 I hereby dub libmicrohttpd a GNU package. -Richard Stallman 14 I hereby dub libmicrohttpd a GNU package. -Richard Stallman
3 15
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index ae93ff05..6246ee21 100644
--- a/src/daemon/connection.c
+++ b/src/daemon/connection.c
@@ -50,7 +50,11 @@
50 * Intentionally empty here to keep our memory footprint 50 * Intentionally empty here to keep our memory footprint
51 * minimal. 51 * minimal.
52 */ 52 */
53#if HAVE_MESSAGES
54#define REQUEST_TOO_BIG "<html><head><title>Request too big</title></head><body>Your HTTP header was too big for the memory constraints of this webserver.</body></html>"
55#else
53#define REQUEST_TOO_BIG "" 56#define REQUEST_TOO_BIG ""
57#endif
54 58
55/** 59/**
56 * Response text used when the request (http header) does not 60 * Response text used when the request (http header) does not
@@ -59,7 +63,11 @@
59 * Intentionally empty here to keep our memory footprint 63 * Intentionally empty here to keep our memory footprint
60 * minimal. 64 * minimal.
61 */ 65 */
66#if HAVE_MESSAGES
67#define REQUEST_LACKS_HOST "<html><head><title>&quot;Host:&quot; header required</title></head><body>In HTTP 1.1, requests must include a &quot;Host:&quot; header, and your HTTP 1.1 request lacked such a header.</body></html>"
68#else
62#define REQUEST_LACKS_HOST "" 69#define REQUEST_LACKS_HOST ""
70#endif
63 71
64/** 72/**
65 * Response text used when the request (http header) is 73 * Response text used when the request (http header) is
@@ -68,7 +76,11 @@
68 * Intentionally empty here to keep our memory footprint 76 * Intentionally empty here to keep our memory footprint
69 * minimal. 77 * minimal.
70 */ 78 */
79#if HAVE_MESSAGES
80#define REQUEST_MALFORMED "<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>"
81#else
71#define REQUEST_MALFORMED "" 82#define REQUEST_MALFORMED ""
83#endif
72 84
73#define EXTRA_CHECKS MHD_YES 85#define EXTRA_CHECKS MHD_YES
74 86
@@ -1627,6 +1639,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
1627 line = get_next_header_line (connection); 1639 line = get_next_header_line (connection);
1628 if (line == NULL) 1640 if (line == NULL)
1629 { 1641 {
1642 if (connection->state != MHD_CONNECTION_INIT)
1643 continue;
1630 if (connection->read_closed) 1644 if (connection->read_closed)
1631 { 1645 {
1632 connection->state = MHD_CONNECTION_CLOSED; 1646 connection->state = MHD_CONNECTION_CLOSED;
@@ -1643,6 +1657,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
1643 line = get_next_header_line (connection); 1657 line = get_next_header_line (connection);
1644 if (line == NULL) 1658 if (line == NULL)
1645 { 1659 {
1660 if (connection->state != MHD_CONNECTION_URL_RECEIVED)
1661 continue;
1646 if (connection->read_closed) 1662 if (connection->read_closed)
1647 { 1663 {
1648 connection->state = MHD_CONNECTION_CLOSED; 1664 connection->state = MHD_CONNECTION_CLOSED;
@@ -1668,6 +1684,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
1668 line = get_next_header_line (connection); 1684 line = get_next_header_line (connection);
1669 if (line == NULL) 1685 if (line == NULL)
1670 { 1686 {
1687 if (connection->state != MHD_CONNECTION_HEADER_PART_RECEIVED)
1688 continue;
1671 if (connection->read_closed) 1689 if (connection->read_closed)
1672 { 1690 {
1673 connection->state = MHD_CONNECTION_CLOSED; 1691 connection->state = MHD_CONNECTION_CLOSED;
@@ -1734,6 +1752,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
1734 line = get_next_header_line (connection); 1752 line = get_next_header_line (connection);
1735 if (line == NULL) 1753 if (line == NULL)
1736 { 1754 {
1755 if (connection->state != MHD_CONNECTION_BODY_RECEIVED)
1756 continue;
1737 if (connection->read_closed) 1757 if (connection->read_closed)
1738 { 1758 {
1739 connection->state = MHD_CONNECTION_CLOSED; 1759 connection->state = MHD_CONNECTION_CLOSED;
@@ -1759,6 +1779,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
1759 line = get_next_header_line (connection); 1779 line = get_next_header_line (connection);
1760 if (line == NULL) 1780 if (line == NULL)
1761 { 1781 {
1782 if (connection->state != MHD_CONNECTION_FOOTER_PART_RECEIVED)
1783 continue;
1762 if (connection->read_closed) 1784 if (connection->read_closed)
1763 { 1785 {
1764 connection->state = MHD_CONNECTION_CLOSED; 1786 connection->state = MHD_CONNECTION_CLOSED;
diff --git a/src/testcurl/daemontest_long_header.c b/src/testcurl/daemontest_long_header.c
index 385b9776..bfdc02e8 100644
--- a/src/testcurl/daemontest_long_header.c
+++ b/src/testcurl/daemontest_long_header.c
@@ -99,7 +99,7 @@ testLongUrlGet ()
99 cbc.buf = buf; 99 cbc.buf = buf;
100 cbc.size = 2048; 100 cbc.size = 2048;
101 cbc.pos = 0; 101 cbc.pos = 0;
102 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */ , 102 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */,
103 1080, 103 1080,
104 &apc_all, 104 &apc_all,
105 NULL, 105 NULL,
@@ -219,7 +219,7 @@ testLongHeaderGet ()
219 MHD_stop_daemon (d); 219 MHD_stop_daemon (d);
220 free (url); 220 free (url);
221 if (code != MHD_HTTP_REQUEST_ENTITY_TOO_LARGE) 221 if (code != MHD_HTTP_REQUEST_ENTITY_TOO_LARGE)
222 return 128; 222 return 128;
223 return 0; 223 return 0;
224} 224}
225 225