summaryrefslogtreecommitdiff
path: root/src/ClientConnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientConnection.cpp')
-rw-r--r--src/ClientConnection.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ClientConnection.cpp b/src/ClientConnection.cpp
index 8982780..6a0670c 100644
--- a/src/ClientConnection.cpp
+++ b/src/ClientConnection.cpp
@@ -1,9 +1,9 @@
#include "ClientConnection.h"
-#include <unistd.h>
+#include <cstring>
#include <iostream>
#include <sstream>
-#include <cstring>
+#include <unistd.h>
ClientConnection::ClientConnection(int socket)
: m_socket_fd(socket)
@@ -15,12 +15,12 @@ HttpRequest ClientConnection::read_request()
// TODO: Clean up this code to ensure it works with multiple lines
// and not risk a buffer overflow.
constexpr int BUFFER_SIZE = 4096;
- char buffer[BUFFER_SIZE+1];
+ char buffer[BUFFER_SIZE + 1];
int n;
memset(buffer, 0, BUFFER_SIZE);
- while ((n = read(m_socket_fd, buffer, BUFFER_SIZE-1)) > 0) {
- if (buffer[n-1] == '\n')
+ while ((n = read(m_socket_fd, buffer, BUFFER_SIZE - 1)) > 0) {
+ if (buffer[n - 1] == '\n')
break;
memset(buffer, 0, BUFFER_SIZE);