Size: 953 bytes.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// cs/net/http/parsers.hh
#ifndef CS_NET_HTTP_PARSERS_HH
#define CS_NET_HTTP_PARSERS_HH

#include <stdint.h>

#include <map>
#include <ostream>
#include <sstream>
#include <string>

#include "cs/result.hh"

namespace cs::net::http::parsers {

cs::Result AtEndOfLine(std::string str,
                       unsigned int cursor);

cs::Result IncrementCursor(std::string str,
                           unsigned int* cursor);

#define STRING_CONTAINS(str, ch) \
  (str.find(ch) != std::string::npos)

cs::Result ReadWord(std::string str, unsigned int* cursor,
                    std::string* token,
                    std::string ending_tokens);

cs::Result ReadThroughNewline(std::string str,
                              unsigned int* cursor);

cs::Result ParsePath(
    std::string original_path, std::string* just_path,
    std::map<std::string, std::string>* query_params);

}  // namespace cs::net::http::parsers

#endif  // CS_NET_HTTP_PARSERS_HH
v0 (commit) © 2025 @p13i.io | Load balancer proxied to: cs-code-viewer-3:8080 in 1ms.