diff options
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 8b242bbf..30aac8c7 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * Intentionally empty here to keep our memory footprint | 56 | * Intentionally empty here to keep our memory footprint |
57 | * minimal. | 57 | * minimal. |
58 | */ | 58 | */ |
59 | #if HAVE_MESSAGES | 59 | #ifdef HAVE_MESSAGES |
60 | #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>" | 60 | #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>" |
61 | #else | 61 | #else |
62 | #define REQUEST_TOO_BIG "" | 62 | #define REQUEST_TOO_BIG "" |
@@ -69,7 +69,7 @@ | |||
69 | * Intentionally empty here to keep our memory footprint | 69 | * Intentionally empty here to keep our memory footprint |
70 | * minimal. | 70 | * minimal. |
71 | */ | 71 | */ |
72 | #if HAVE_MESSAGES | 72 | #ifdef HAVE_MESSAGES |
73 | #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>" | 73 | #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>" |
74 | #else | 74 | #else |
75 | #define REQUEST_LACKS_HOST "" | 75 | #define REQUEST_LACKS_HOST "" |
@@ -82,7 +82,7 @@ | |||
82 | * Intentionally empty here to keep our memory footprint | 82 | * Intentionally empty here to keep our memory footprint |
83 | * minimal. | 83 | * minimal. |
84 | */ | 84 | */ |
85 | #if HAVE_MESSAGES | 85 | #ifdef HAVE_MESSAGES |
86 | #define REQUEST_MALFORMED "<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>" | 86 | #define REQUEST_MALFORMED "<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>" |
87 | #else | 87 | #else |
88 | #define REQUEST_MALFORMED "" | 88 | #define REQUEST_MALFORMED "" |
@@ -94,7 +94,7 @@ | |||
94 | * Intentionally empty here to keep our memory footprint | 94 | * Intentionally empty here to keep our memory footprint |
95 | * minimal. | 95 | * minimal. |
96 | */ | 96 | */ |
97 | #if HAVE_MESSAGES | 97 | #ifdef HAVE_MESSAGES |
98 | #define INTERNAL_ERROR "<html><head><title>Internal server error</title></head><body>Some programmer needs to study the manual more carefully.</body></html>" | 98 | #define INTERNAL_ERROR "<html><head><title>Internal server error</title></head><body>Some programmer needs to study the manual more carefully.</body></html>" |
99 | #else | 99 | #else |
100 | #define INTERNAL_ERROR "" | 100 | #define INTERNAL_ERROR "" |
@@ -503,7 +503,7 @@ static void | |||
503 | connection_close_error (struct MHD_Connection *connection, | 503 | connection_close_error (struct MHD_Connection *connection, |
504 | const char *emsg) | 504 | const char *emsg) |
505 | { | 505 | { |
506 | #if HAVE_MESSAGES | 506 | #ifdef HAVE_MESSAGES |
507 | if (NULL != emsg) | 507 | if (NULL != emsg) |
508 | MHD_DLOG (connection->daemon, emsg); | 508 | MHD_DLOG (connection->daemon, emsg); |
509 | #endif | 509 | #endif |
@@ -516,7 +516,7 @@ connection_close_error (struct MHD_Connection *connection, | |||
516 | * Macro to only include error message in call to | 516 | * Macro to only include error message in call to |
517 | * "connection_close_error" if we have HAVE_MESSAGES. | 517 | * "connection_close_error" if we have HAVE_MESSAGES. |
518 | */ | 518 | */ |
519 | #if HAVE_MESSAGES | 519 | #ifdef HAVE_MESSAGES |
520 | #define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, emsg) | 520 | #define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, emsg) |
521 | #else | 521 | #else |
522 | #define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, NULL) | 522 | #define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, NULL) |
@@ -1054,7 +1054,7 @@ build_header_response (struct MHD_Connection *connection) | |||
1054 | data = MHD_pool_allocate (connection->pool, size + 1, MHD_NO); | 1054 | data = MHD_pool_allocate (connection->pool, size + 1, MHD_NO); |
1055 | if (NULL == data) | 1055 | if (NULL == data) |
1056 | { | 1056 | { |
1057 | #if HAVE_MESSAGES | 1057 | #ifdef HAVE_MESSAGES |
1058 | MHD_DLOG (connection->daemon, | 1058 | MHD_DLOG (connection->daemon, |
1059 | "Not enough memory for write!\n"); | 1059 | "Not enough memory for write!\n"); |
1060 | #endif | 1060 | #endif |
@@ -1148,7 +1148,7 @@ transmit_error_response (struct MHD_Connection *connection, | |||
1148 | } | 1148 | } |
1149 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; | 1149 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; |
1150 | connection->read_closed = MHD_YES; | 1150 | connection->read_closed = MHD_YES; |
1151 | #if HAVE_MESSAGES | 1151 | #ifdef HAVE_MESSAGES |
1152 | MHD_DLOG (connection->daemon, | 1152 | MHD_DLOG (connection->daemon, |
1153 | "Error %u (`%s') processing request, closing connection.\n", | 1153 | "Error %u (`%s') processing request, closing connection.\n", |
1154 | status_code, message); | 1154 | status_code, message); |
@@ -1392,7 +1392,7 @@ connection_add_header (struct MHD_Connection *connection, | |||
1392 | key, | 1392 | key, |
1393 | value)) | 1393 | value)) |
1394 | { | 1394 | { |
1395 | #if HAVE_MESSAGES | 1395 | #ifdef HAVE_MESSAGES |
1396 | MHD_DLOG (connection->daemon, | 1396 | MHD_DLOG (connection->daemon, |
1397 | "Not enough memory to allocate header record!\n"); | 1397 | "Not enough memory to allocate header record!\n"); |
1398 | #endif | 1398 | #endif |
@@ -1432,7 +1432,7 @@ parse_cookie_header (struct MHD_Connection *connection) | |||
1432 | cpy = MHD_pool_allocate (connection->pool, strlen (hdr) + 1, MHD_YES); | 1432 | cpy = MHD_pool_allocate (connection->pool, strlen (hdr) + 1, MHD_YES); |
1433 | if (NULL == cpy) | 1433 | if (NULL == cpy) |
1434 | { | 1434 | { |
1435 | #if HAVE_MESSAGES | 1435 | #ifdef HAVE_MESSAGES |
1436 | MHD_DLOG (connection->daemon, | 1436 | MHD_DLOG (connection->daemon, |
1437 | "Not enough memory to parse cookies!\n"); | 1437 | "Not enough memory to parse cookies!\n"); |
1438 | #endif | 1438 | #endif |
@@ -1754,7 +1754,7 @@ process_request_body (struct MHD_Connection *connection) | |||
1754 | } | 1754 | } |
1755 | if (processed > used) | 1755 | if (processed > used) |
1756 | mhd_panic (mhd_panic_cls, __FILE__, __LINE__ | 1756 | mhd_panic (mhd_panic_cls, __FILE__, __LINE__ |
1757 | #if HAVE_MESSAGES | 1757 | #ifdef HAVE_MESSAGES |
1758 | , "API violation" | 1758 | , "API violation" |
1759 | #else | 1759 | #else |
1760 | , NULL | 1760 | , NULL |
@@ -2040,7 +2040,7 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
2040 | /* die, http 1.1 request without host and we are pedantic */ | 2040 | /* die, http 1.1 request without host and we are pedantic */ |
2041 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; | 2041 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; |
2042 | connection->read_closed = MHD_YES; | 2042 | connection->read_closed = MHD_YES; |
2043 | #if HAVE_MESSAGES | 2043 | #ifdef HAVE_MESSAGES |
2044 | MHD_DLOG (connection->daemon, | 2044 | MHD_DLOG (connection->daemon, |
2045 | "Received `%s' request without `%s' header.\n", | 2045 | "Received `%s' request without `%s' header.\n", |
2046 | MHD_HTTP_VERSION_1_1, MHD_HTTP_HEADER_HOST); | 2046 | MHD_HTTP_VERSION_1_1, MHD_HTTP_HEADER_HOST); |
@@ -2076,7 +2076,7 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
2076 | if ( ('\0' != *end) || | 2076 | if ( ('\0' != *end) || |
2077 | ( (LONG_MAX == cval) && (errno == ERANGE) ) ) | 2077 | ( (LONG_MAX == cval) && (errno == ERANGE) ) ) |
2078 | { | 2078 | { |
2079 | #if HAVE_MESSAGES | 2079 | #ifdef HAVE_MESSAGES |
2080 | MHD_DLOG (connection->daemon, | 2080 | MHD_DLOG (connection->daemon, |
2081 | "Failed to parse `%s' header `%s', closing connection.\n", | 2081 | "Failed to parse `%s' header `%s', closing connection.\n", |
2082 | MHD_HTTP_HEADER_CONTENT_LENGTH, | 2082 | MHD_HTTP_HEADER_CONTENT_LENGTH, |
@@ -2229,7 +2229,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
2229 | const int err = MHD_socket_errno_; | 2229 | const int err = MHD_socket_errno_; |
2230 | if ((err == EINTR) || (err == EAGAIN) || (EWOULDBLOCK == err)) | 2230 | if ((err == EINTR) || (err == EAGAIN) || (EWOULDBLOCK == err)) |
2231 | break; | 2231 | break; |
2232 | #if HAVE_MESSAGES | 2232 | #ifdef HAVE_MESSAGES |
2233 | MHD_DLOG (connection->daemon, | 2233 | MHD_DLOG (connection->daemon, |
2234 | "Failed to send data: %s\n", | 2234 | "Failed to send data: %s\n", |
2235 | MHD_socket_last_strerr_ ()); | 2235 | MHD_socket_last_strerr_ ()); |
@@ -2296,7 +2296,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
2296 | { | 2296 | { |
2297 | if ((err == EINTR) || (err == EAGAIN) || (EWOULDBLOCK == err)) | 2297 | if ((err == EINTR) || (err == EAGAIN) || (EWOULDBLOCK == err)) |
2298 | return MHD_YES; | 2298 | return MHD_YES; |
2299 | #if HAVE_MESSAGES | 2299 | #ifdef HAVE_MESSAGES |
2300 | MHD_DLOG (connection->daemon, | 2300 | MHD_DLOG (connection->daemon, |
2301 | "Failed to send data: %s\n", | 2301 | "Failed to send data: %s\n", |
2302 | MHD_socket_last_strerr_ ()); | 2302 | MHD_socket_last_strerr_ ()); |
@@ -2909,7 +2909,7 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection) | |||
2909 | connection->socket_fd, | 2909 | connection->socket_fd, |
2910 | &event)) | 2910 | &event)) |
2911 | { | 2911 | { |
2912 | #if HAVE_MESSAGES | 2912 | #ifdef HAVE_MESSAGES |
2913 | if (0 != (daemon->options & MHD_USE_DEBUG)) | 2913 | if (0 != (daemon->options & MHD_USE_DEBUG)) |
2914 | MHD_DLOG (daemon, | 2914 | MHD_DLOG (daemon, |
2915 | "Call to epoll_ctl failed: %s\n", | 2915 | "Call to epoll_ctl failed: %s\n", |