Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
symbian::http::internal Namespace Reference

Classes

struct  BodyPlan
 Body delimitation derived from a message's headers.
 
class  ChunkedDecoder
 Incremental decoder for Transfer-Encoding: chunked bodies.
 
struct  Http1RequestHead
 The parsed start line and headers of an HTTP/1.1 request.
 
struct  Http1ResponseHead
 The parsed status line and headers of an HTTP/1.1 response.
 

Enumerations

enum class  BodyFraming { kNone , kContentLength , kChunked , kUntilClose }
 How a message body is delimited on the wire. More...
 

Functions

std::optional< std::size_t > FindHeaderBlockEnd (std::string_view data)
 
absl::StatusOr< Http1RequestHead > ParseRequestHead (std::string_view head_block)
 Parses a request head (start line + headers, no trailing CRLFCRLF needed).
 
absl::StatusOr< Http1ResponseHead > ParseResponseHead (std::string_view head_block)
 Parses a response head (status line + headers).
 
absl::StatusOr< BodyPlan > PlanRequestBody (const Headers &headers)
 
absl::StatusOr< BodyPlan > PlanResponseBody (std::string_view request_method, int status, const Headers &headers)
 
std::string EncodeChunk (std::string_view data)
 
std::string EncodeLastChunk (const Headers &trailers)
 
void AppendHeaderBlock (const Headers &headers, std::string *out)
 Appends "name: value\r\n" for each header to out (names sent as given).
 
std::string SerializeRequest (std::string_view method, std::string_view target, const Headers &headers)
 Serializes an HTTP/1.1 request head (start line + headers + CRLF).
 
std::string SerializeResponse (int status, const Headers &headers, std::string_view reason={})
 Serializes an HTTP/1.1 response head (status line + headers + CRLF).
 
std::string_view DefaultReasonPhrase (int status)
 

Enumeration Type Documentation

◆ BodyFraming

How a message body is delimited on the wire.

Enumerator
kNone 

No body (e.g. GET request, 204/304 response).

kContentLength 

Exactly content_length bytes.

kChunked 

Transfer-Encoding: chunked.

kUntilClose 

Body runs until the connection closes (response only).

Function Documentation

◆ AppendHeaderBlock()

void symbian::http::internal::AppendHeaderBlock ( const Headers &  headers,
std::string *  out 
)

Appends "name: value\r\n" for each header to out (names sent as given).

◆ DefaultReasonPhrase()

std::string_view symbian::http::internal::DefaultReasonPhrase ( int  status)
Returns
The standard reason phrase for status (may be empty).

◆ EncodeChunk()

std::string symbian::http::internal::EncodeChunk ( std::string_view  data)
Returns
data wrapped as a single chunked-transfer chunk. Empty input yields an empty string (callers must not emit a zero-size data chunk).

◆ EncodeLastChunk()

std::string symbian::http::internal::EncodeLastChunk ( const Headers &  trailers = {})
Returns
The terminating zero-length chunk that ends a chunked body, followed by trailers as a trailer section when any are given.

◆ FindHeaderBlockEnd()

std::optional< std::size_t > symbian::http::internal::FindHeaderBlockEnd ( std::string_view  data)
Returns
The index just past the end of the header block (the position after the terminating CRLFCRLF) within data, or nullopt if the terminator has not yet arrived. Also accepts a bare LFLF terminator for lenient input.

◆ ParseRequestHead()

absl::StatusOr< Http1RequestHead > symbian::http::internal::ParseRequestHead ( std::string_view  head_block)

Parses a request head (start line + headers, no trailing CRLFCRLF needed).

◆ ParseResponseHead()

absl::StatusOr< Http1ResponseHead > symbian::http::internal::ParseResponseHead ( std::string_view  head_block)

Parses a response head (status line + headers).

◆ PlanRequestBody()

absl::StatusOr< BodyPlan > symbian::http::internal::PlanRequestBody ( const Headers &  headers)
Returns
How a request body is framed given its headers.

◆ PlanResponseBody()

absl::StatusOr< BodyPlan > symbian::http::internal::PlanResponseBody ( std::string_view  request_method,
int  status,
const Headers &  headers 
)
Returns
How a response body is framed given the request method and the response status/headers (per RFC 9112: HEAD, 1xx, 204, 304 carry no body).

◆ SerializeRequest()

std::string symbian::http::internal::SerializeRequest ( std::string_view  method,
std::string_view  target,
const Headers &  headers 
)

Serializes an HTTP/1.1 request head (start line + headers + CRLF).

◆ SerializeResponse()

std::string symbian::http::internal::SerializeResponse ( int  status,
const Headers &  headers,
std::string_view  reason 
)

Serializes an HTTP/1.1 response head (status line + headers + CRLF).