Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::net::http::HttpUtil Class Reference

HTTP Utility Class. More...

#include <HttpUtil.h>

Public Types

using InputStream = io::InputStream
 
using OutputStream = io::OutputStream
 

Static Public Member Functions

static bool recvRequest (InputStream *source, RequestHeader *request) noexcept
 Receive a request from a stream.
 
static bool sendRequest (OutputStream *dest, RequestHeader *request) noexcept
 Send a request to a stream.
 
static bool recvResponse (InputStream *source, ResponseHeader *response) noexcept
 Receive a response from a stream.
 
static bool sendResponse (OutputStream *dest, ResponseHeader *response) noexcept
 Send a response to a stream.
 
static Cookie::Ptr parseFromSetCookie (const std::string &text) noexcept
 
static CookieMap::Ptr parseFromCookie (const std::string &text) noexcept
 

Static Public Attributes

static std::map< std::string, std::string > content_type_map
 Content-Type extension mapping.
 

Static Private Member Functions

static bool getLine (InputStream *source, text::StringBuilder &builder) noexcept
 
static bool recvHeader (InputStream *source, text::StringBuilder &builder, Header *header, bool is_resp=false) noexcept
 
static bool sendHeader (OutputStream *dest, Header *header, bool is_resp=false) noexcept
 
static bool sendSetCookie (OutputStream *dest, const CookieMap::Ptr &cookies) noexcept
 
static bool sendCookie (OutputStream *dest, const CookieMap::Ptr &cookies) noexcept
 

Detailed Description

HTTP Utility Class.

Member Typedef Documentation

◆ InputStream

◆ OutputStream

Member Function Documentation

◆ getLine()

bool HttpUtil::getLine ( InputStream * source,
text::StringBuilder & builder )
staticprivatenoexcept

◆ parseFromCookie()

CookieMap::Ptr HttpUtil::parseFromCookie ( const std::string & text)
staticnoexcept

◆ parseFromSetCookie()

Cookie::Ptr HttpUtil::parseFromSetCookie ( const std::string & text)
staticnoexcept

◆ recvHeader()

bool HttpUtil::recvHeader ( InputStream * source,
text::StringBuilder & builder,
Header * header,
bool is_resp = false )
inlinestaticprivatenoexcept

◆ recvRequest()

bool HttpUtil::recvRequest ( InputStream * source,
RequestHeader * request )
staticnoexcept

Receive a request from a stream.

Parameters
sourceTarget source
requestRequest
Returns
true If the request is successfully received
false If the request fails to be received

References sese::text::AbstractStringBuffer::clear(), sese::text::AbstractStringBuffer::split(), and sese::net::http::stringToRequestType().

◆ recvResponse()

bool HttpUtil::recvResponse ( InputStream * source,
ResponseHeader * response )
staticnoexcept

Receive a response from a stream.

Parameters
sourceTarget source
responseResponse
Returns
true If the response is successfully received
false If the response fails to be received

References _atoi64, sese::text::AbstractStringBuffer::clear(), and sese::text::AbstractStringBuffer::split().

Referenced by sese::internal::net::http::HttpClientImpl::request().

◆ sendCookie()

bool HttpUtil::sendCookie ( OutputStream * dest,
const CookieMap::Ptr & cookies )
inlinestaticprivatenoexcept

References WRITE.

◆ sendHeader()

bool HttpUtil::sendHeader ( OutputStream * dest,
Header * header,
bool is_resp = false )
inlinestaticprivatenoexcept

References WRITE.

◆ sendRequest()

bool HttpUtil::sendRequest ( OutputStream * dest,
RequestHeader * request )
staticnoexcept

Send a request to a stream.

Parameters
destDestination stream
requestRequest
Returns
true If the request is successfully sent
false If the request fails to be sent

References sese::net::http::requestTypeToString().

Referenced by sese::internal::net::http::HttpClientImpl::request().

◆ sendResponse()

bool HttpUtil::sendResponse ( OutputStream * dest,
ResponseHeader * response )
staticnoexcept

Send a response to a stream.

Parameters
destDestination stream
responseResponse
Returns
true If the response is successfully sent
false If the response fails to be sent

Referenced by sese::internal::service::http::HttpConnection::handleRequest().

◆ sendSetCookie()

bool HttpUtil::sendSetCookie ( OutputStream * dest,
const CookieMap::Ptr & cookies )
inlinestaticprivatenoexcept

Member Data Documentation

◆ content_type_map

std::map< std::string, std::string > sese::net::http::HttpUtil::content_type_map
static

Content-Type extension mapping.

Referenced by sese::internal::service::http::HttpServiceImpl::handleRequest().


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