Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
http1.h File Reference

Dependency-free HTTP/1.1 message parsing and serialization. More...

#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <absl/status/status.h>
#include <absl/status/statusor.h>
#include "symbian/http/types.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  symbian
 
namespace  symbian::http
 
namespace  symbian::http::internal
 

Enumerations

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

Functions

std::optional< std::size_t > symbian::http::internal::FindHeaderBlockEnd (std::string_view data)
 
absl::StatusOr< Http1RequestHead > symbian::http::internal::ParseRequestHead (std::string_view head_block)
 Parses a request head (start line + headers, no trailing CRLFCRLF needed).
 
absl::StatusOr< Http1ResponseHead > symbian::http::internal::ParseResponseHead (std::string_view head_block)
 Parses a response head (status line + headers).
 
absl::StatusOr< BodyPlan > symbian::http::internal::PlanRequestBody (const Headers &headers)
 
absl::StatusOr< BodyPlan > symbian::http::internal::PlanResponseBody (std::string_view request_method, int status, const Headers &headers)
 
std::string symbian::http::internal::EncodeChunk (std::string_view data)
 
std::string symbian::http::internal::EncodeLastChunk (const Headers &trailers)
 
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).
 
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).
 
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).
 
std::string_view symbian::http::internal::DefaultReasonPhrase (int status)
 

Detailed Description

Dependency-free HTTP/1.1 message parsing and serialization.

A small, I/O-free codec covering exactly what the A11 SSE and WebSocket transports need over HTTP/1.1: request/status line and header parsing, chunked transfer-encoding encode/decode, body framing determination, and bounded trailer parsing. Everything here operates on byte buffers so it is unit-testable in isolation and shared by the client and server connections.