17 for (
size_t i = 0; i <
result.size(); i++) {
25 if (str.
empty())
return str;
42 if (str.
empty())
return false;
45 for (
size_t i = 0; i < str.
size(); i++) {
95 auto contentLength =
getHeader(
"Content-Length");
96 auto transferEncoding =
getHeader(
"Transfer-Encoding");
98 if (transferEncoding.has_value() &&
102 }
else if (contentLength.has_value()) {
103 int contentLengthInt = 0;
104 if (
parseInt(contentLength.value(), contentLengthInt)) {
163 if (!crlfPos.has_value()) {
173 size_t methodEnd = line.
find(
' ');
178 size_t uriEnd = line.
find(
' ', methodEnd + 1);
184 req().
uri = line.
substr(methodEnd + 1, uriEnd - methodEnd - 1);
193 if (!crlfPos.has_value()) {
198 if (crlfPos.value() == 0) {
208 size_t colonPos = line.
find(
':');
255 for (
size_t i = 0; i + 1 <
mBuffer.size(); i++) {
276 for (
const auto&
pair :
req().headers) {
304 bool progress =
true;
323 auto contentLength =
getHeader(
"Content-Length");
324 auto transferEncoding =
getHeader(
"Transfer-Encoding");
326 if (transferEncoding.has_value() &&
330 }
else if (contentLength.has_value()) {
331 int contentLengthInt = 0;
332 if (
parseInt(contentLength.value(), contentLengthInt)) {
391 if (!crlfPos.has_value()) {
400 size_t versionEnd = line.
find(
' ');
405 size_t statusEnd = line.
find(
' ', versionEnd + 1);
408 statusEnd = line.
size();
412 fl::string statusStr = line.
substr(versionEnd + 1, statusEnd - versionEnd - 1);
418 if (statusEnd < line.
size()) {
428 if (!crlfPos.has_value()) {
433 if (crlfPos.value() == 0) {
443 size_t colonPos = line.
find(
':');
490 for (
size_t i = 0; i + 1 <
mBuffer.size(); i++) {
511 for (
const auto&
pair :
resp().headers) {
fl::optional< fl::string > getHeader(const char *name) const
~HttpRequestParser() FL_NOEXCEPT
fl::shared_ptr< net::http::ChunkedReader > mChunkedReader
fl::optional< size_t > findCRLF() const
fl::shared_ptr< HttpRequest > mRequest
HttpRequestParser() FL_NOEXCEPT
HttpRequestPtrConst getRequest()
void feed(fl::span< const u8 > data)
HttpResponseParser() FL_NOEXCEPT
fl::optional< size_t > findCRLF() const
~HttpResponseParser() FL_NOEXCEPT
HttpResponsePtrConst getResponse()
void feed(fl::span< const u8 > data)
fl::shared_ptr< HttpResponse > mResponse
fl::shared_ptr< net::http::ChunkedReader > mChunkedReader
fl::optional< fl::string > getHeader(const char *name) const
bool empty() const FL_NOEXCEPT
fl::size find(const char &value) const FL_NOEXCEPT
fl::size size() const FL_NOEXCEPT
string substr(fl::size start, fl::size length) const FL_NOEXCEPT
static constexpr fl::size npos
fl::size size() const FL_NOEXCEPT
bool insert(iterator pos, const T &value) FL_NOEXCEPT
void resize(fl::size n) FL_NOEXCEPT
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
fl::string toLower(const fl::string &str)
fl::string http_parser_trim(const fl::string &str)
fl::shared_ptr< HttpResponse > HttpResponsePtr
char tolower(char c) FL_NOEXCEPT
Convert character to lowercase.
constexpr int type_rank< T >::value
bool isdigit(char c) FL_NOEXCEPT
Check if character is a decimal digit (0-9)
int parseInt(const char *str, fl::size len)
Parse an integer from a character buffer.
constexpr T * end(T(&array)[N]) FL_NOEXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
fl::shared_ptr< const HttpResponse > HttpResponsePtrConst
fl::shared_ptr< const HttpRequest > HttpRequestPtrConst
constexpr nullopt_t nullopt
fl::shared_ptr< HttpRequest > HttpRequestPtr
bool isspace(char c) FL_NOEXCEPT
Check if character is whitespace (space, tab, newline, carriage return)
Base definition for an LED controller.
fl::flat_map< fl::string, fl::string, fl::StringFastLess > headers
fl::flat_map< fl::string, fl::string, fl::StringFastLess > headers