Open 0xOnyx opened 1 year ago
Accordingly to what we discussed before, by HTTP request you mean HTTP response I think ?
Yes, we should create a template class that would allow creating requests according to the HTTP1.1 standard. Here's what it should take as parameters for the constructor:
The request status, e.g., 200, 404, etc., as an integer The length of the body as a size_t The type of the body as a std::string If the length is greater than 0, then take the body as a std::string. Then, you should return a correctly formatted std::string that I can send when the socket is available for writing, as follows:
HTTP/1.1 200 OK Content-Type: text/html
<!DOCTYPE html>
make a class that allows you to generate HTTP requests and that returns all of these in a std::string