u413-284-si / webserv

This project is about setting up a http web server, providing a static website.
MIT License
0 stars 0 forks source link

4 req parsing define minimal request #10

Closed u413-284-si closed 2 months ago

u413-284-si commented 3 months ago

Implements a HTTP request parser according to RFC 7230:

  1. Request Parser class

    • takes http request as input string
    • parses request content into a HTTPRequest struct
    • struct members:
    • strings for method, version, body
    • substruct of strings for URI (path, query, fragment)
    • map<string, string> for headers (key - value storage)
    • contains multiple checker functions to implement conditions defined by the RFC which are to be met and if not, sets an error code which can be retrieved by the response builder to create the appropriate response
    • contains bit flag for the request method which can be retrieved by the response builder and easily processed (suggestion, could be easier than reading the string saved in the struct)
    • returns filled HTTPRequest struct
  2. errors

    • separate header defining different error constants
  3. utilities

    • general helper functions declared and defined in separate files
  4. Tester for

    • request line
    • headers Implements various tests to verify correct parsing of valid input and detection of invalid ones.

closes #4

u413-284-si commented 3 months ago

I have uploaded another PR (11 chunked message bodies) which is based off this one. Please all have a look at that PR, and after the other branch is successfully merge with this one, I will start implementing requested changes in this branch in order to avoid merge conflicts.