summaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: 60c7b4f4b7827842eca6897dc19e02090e20e552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>

#include "ClientConnection.h"
#include "HttpResponse.h"
#include "ServerConnection.h"

int main(int argc, char** argv)
{
	ServerConnection server(8080);

	std::cout << "cfws v0.1.0]\n";

	while (true) {
		std::cout << "Waiting for connections on port 8080" << std::endl;
		ClientConnection client = server.accept_client_connection();
		client.dump_request_data();

		HttpResponse http_response(ResponseCode::OK);
		http_response.add_header("Server: cfws");

		const char* message = "Welcome to the page.";
		client.send(http_response, message);
		client.close();
	}
}