|
76 | 76 | #define LOG_DIRECTORY_SIZE_LIMIT_MB 100 |
77 | 77 | #endif |
78 | 78 |
|
| 79 | +#define KEEPALIVE_MAXREQS 1000 |
| 80 | + |
79 | 81 | #define LOG_DIRECTORY "logs" |
80 | 82 |
|
81 | 83 | #define HTTPS_KEY_FILE "key.pem" |
@@ -1064,7 +1066,7 @@ bool should_keep_alive(Connection *conn) |
1064 | 1066 | return false; |
1065 | 1067 |
|
1066 | 1068 | // Don't keep alive if we served a lot of requests to this connection |
1067 | | - if (conn->served_count > 100) |
| 1069 | + if (conn->served_count > KEEPALIVE_MAXREQS) |
1068 | 1070 | return false; |
1069 | 1071 |
|
1070 | 1072 | // Don't keep alive if the server is more than 70% full |
@@ -1201,11 +1203,11 @@ bool respond_to_available_requests(Connection *conn) |
1201 | 1203 | // Reset the request timer |
1202 | 1204 | conn->start_time = now; |
1203 | 1205 |
|
1204 | | - conn->keep_alive = false; |
| 1206 | + conn->keep_alive = true; |
1205 | 1207 | string keep_alive_header; |
1206 | 1208 | if (find_header(&request, LIT("Connection"), &keep_alive_header)) { |
1207 | | - if (string_match_case_insensitive(trim(keep_alive_header), LIT("Keep-Alive"))) |
1208 | | - conn->keep_alive = true; |
| 1209 | + if (string_match_case_insensitive(trim(keep_alive_header), LIT("Close"))) |
| 1210 | + conn->keep_alive = false; |
1209 | 1211 | } |
1210 | 1212 | // Respond |
1211 | 1213 | ResponseBuilder builder; |
@@ -1543,6 +1545,13 @@ int main(int argc, char **argv) |
1543 | 1545 |
|
1544 | 1546 | init_globals(); |
1545 | 1547 |
|
| 1548 | + log_format("BACKTRACE=%d\n", BACKTRACE); |
| 1549 | + log_format("EOPALLOC=%d\n", EOPALLOC); |
| 1550 | + log_format("PROFILE=%d\n", PROFILE); |
| 1551 | + log_format("ACCESS_LOG=%d\n", ACCESS_LOG); |
| 1552 | + log_format("SHOW_IO=%d\n", SHOW_IO); |
| 1553 | + log_format("SHOW_REQUESTS=%d\n", SHOW_REQUESTS); |
| 1554 | + |
1546 | 1555 | DEBUG("Globals initialized\n"); |
1547 | 1556 |
|
1548 | 1557 | uint64_t last_log_time = 0; |
|
0 commit comments