Runtime: Globally manages polling and task scheduling
Task: An interface for any stateful task that needs to read or write, possibly multiple times.
Response: An abstract class for any response that can be sent
Reader: A helper class for managing a read buffer
Along with the following major derived classes:
ServerAcceptTask: A task that continuously accepts new connections for one connection and schedules more tasks to handle those connections.
ServerReceiveRequestTask: A task for receiving a request + building and scheduling sending the response.
ServerSendResponseTask: A task for sending a ready response.
As well as initial implementations for the following data classes and exceptions:
URI (partial impl)
HTTPVersion (final?)
RequestLine (close to final)
Request (partial impl)
Error (internal errors)
HTTPError (external errors)
As well as a logger, some tests and all that nice stuff.
Server behavior
Currently the server will launch binding to the port 8000, and start accepting requests. The connection will read a request line (delimited by a newline), validate & parse it and then keep accepting header-lines until the input reaches an empty line (end of headers). Upon reaching end-of-headers, the server will send a simple default response.
A connection will remain open until:
A request has been fully processed and responded to.
An error has occurred.
The client closes the connection.
What can be done next:
[x] Implement parsing headers (currently are only stored into a vector of strings
[ ] Implement receiving a request body
[ ] Implement URI parsing
[ ] Implement proper responses (serving files etc) by deriving from the Response class
[ ] Implement routing (partially blocked by at leasts serving files / URI parsing)
[ ] Implement splitting the configuration & spawning multiple servers
Summary
This PR implements the following major classes:
Along with the following major derived classes:
As well as initial implementations for the following data classes and exceptions:
As well as a logger, some tests and all that nice stuff.
Server behavior
Currently the server will launch binding to the port
8000
, and start accepting requests. The connection will read a request line (delimited by a newline), validate & parse it and then keep accepting header-lines until the input reaches an empty line (end of headers). Upon reaching end-of-headers, the server will send a simple default response.A connection will remain open until:
What can be done next: