Webserv
Loading...
Searching...
No Matches
http::RequestStartLine Class Reference

Holds the parsed components of an HTTP request's first line. More...

#include <Request.hpp>

Public Types

enum  Method {
  GET , HEAD , POST , PUT ,
  DELETE , UNKNOWN
}

Public Member Functions

 RequestStartLine ()

Static Public Member Functions

static RequestStartLine parse (std::string const &line)
 Parses a raw request line (e.g., "GET /path?q HTTP/1.1").
static Method matchHttpMethod (std::string const &s)
 Converts a method string (e.g., "GET") to its enum.
static char const * methodToString (Method m)
 Converts a method enum to its string representation.

Public Attributes

Method method
std::string uri
 The full, original request-target (e.g., "/path?query=1")
std::string path
 The path portion only (e.g., "/path")
std::string queryString
 The query string only (e.g., "query=1")
std::string version
 The HTTP protocol version (e.g., "HTTP/1.1")

Detailed Description

Holds the parsed components of an HTTP request's first line.

Member Enumeration Documentation

◆ Method

Enumerator
GET 
HEAD 
POST 
PUT 
DELETE 
UNKNOWN 

Constructor & Destructor Documentation

◆ RequestStartLine()

http::RequestStartLine::RequestStartLine ( )

Member Function Documentation

◆ matchHttpMethod()

RequestStartLine::Method http::RequestStartLine::matchHttpMethod ( std::string const & s)
static

Converts a method string (e.g., "GET") to its enum.

◆ methodToString()

char const * http::RequestStartLine::methodToString ( Method m)
static

Converts a method enum to its string representation.

◆ parse()

RequestStartLine http::RequestStartLine::parse ( std::string const & line)
static

Parses a raw request line (e.g., "GET /path?q HTTP/1.1").

Parameters
lineThe raw string to parse.
Returns
A populated RequestStartLine object.

Member Data Documentation

◆ method

Method http::RequestStartLine::method

◆ path

std::string http::RequestStartLine::path

The path portion only (e.g., "/path")

◆ queryString

std::string http::RequestStartLine::queryString

The query string only (e.g., "query=1")

◆ uri

std::string http::RequestStartLine::uri

The full, original request-target (e.g., "/path?query=1")

◆ version

std::string http::RequestStartLine::version

The HTTP protocol version (e.g., "HTTP/1.1")


The documentation for this class was generated from the following files: