diff options
Diffstat (limited to 'src/daemon/connection.c')
-rw-r--r-- | src/daemon/connection.c | 22 |
1 files changed, 22 insertions, 0 deletions
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>"Host:" header required</title></head><body>In HTTP 1.1, requests must include a "Host:" 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; |