#include <assert.h>
#include <errno.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
// Log to access_log.
access_log->write(client->get_stats());
+ // Flush pending data; does not cancel out TCP_CORK (since that still takes priority),
+ // but does a one-off flush.
+ int one = 1;
+ if (setsockopt(client->sock, SOL_TCP, TCP_NODELAY, &one, sizeof(one)) == -1) {
+ log_perror("setsockopt(TCP_NODELAY)");
+ // Can still continue.
+ }
+
// Switch states and reset the parsers. We don't reset statistics.
client->state = Client::READING_REQUEST;
client->url.clear();