Responsible for HTTP string and URL parsing Including functions to extract parameters, IP, port, request header fields, etc., from URLs or request messages.
More...
|
| static size_t | get_split_str (const std::string_view &ori_str, std::string_view &str, const std::string_view &a, const std::string_view &b, const size_t &pos=0) |
| | Extract a substring between two markers from the original string. More...
|
| |
| static std::string_view & | get_value_str (const std::string_view &ori_str, std::string_view &str, const std::string &name) |
| | Extract the value of a specified key from the URL query parameters. More...
|
| |
| static std::string_view & | get_value_header (const std::string_view &ori_str, std::string_view &str, const std::string &name) |
| | Extract the value of a specified field from the HTTP request header. More...
|
| |
| static std::string_view & | get_location_str (const std::string_view &ori_str, std::string_view &str) |
| | Extract the path and query part from the URL. More...
|
| |
| static std::string_view & | getLocPara (const std::string_view &url, std::string_view &locPara) |
| | Extract the path part of the URL (excluding the query). More...
|
| |
| static std::string_view & | getPara (const std::string_view &url, std::string_view ¶) |
| | Get the query parameter string in the URL (including ?). More...
|
| |
| static size_t | get_split_str (const std::string_view &ori_str, std::string &str, const std::string_view &a, const std::string_view &b, const size_t &pos=0) |
| | Extract a substring between two markers from the original string. More...
|
| |
| static std::string & | get_value_str (const std::string &ori_str, std::string &str, const std::string &name) |
| | Extract the value of a specified key from the URL query parameters. More...
|
| |
| static std::string & | get_value_header (const std::string &ori_str, std::string &str, const std::string &name) |
| | Extract the value of a specified field from the HTTP request header. More...
|
| |
| static std::string & | get_location_str (const std::string &ori_str, std::string &str) |
| | Extract the path and query part from the URL. More...
|
| |
| static std::string & | getLocPara (const std::string &url, std::string &locPara) |
| | Extract the path part of the URL (excluding the query). More...
|
| |
| static std::string & | getPara (const std::string &url, std::string ¶) |
| | Get the query parameter string in the URL (including ?). More...
|
| |
| static std::string & | getIP (const std::string &url, std::string &IP) |
| | Extract the host IP or domain name from the URL. More...
|
| |
| static int & | getPort (const std::string &url, int &port) |
| | Extract the port number from the URL. More...
|
| |
| static std::string | createHeader (const std::string &first, const std::string &second) |
| | Create an HTTP request header field string. More...
|
| |
| template<class... Args> |
| static std::string | createHeader (const std::string &first, const std::string &second, Args...args) |
| | Recursively construct multiple HTTP request header fields. More...
|
| |
Responsible for HTTP string and URL parsing Including functions to extract parameters, IP, port, request header fields, etc., from URLs or request messages.
| static size_t stt::data::HttpStringUtil::get_split_str |
( |
const std::string_view & |
ori_str, |
|
|
std::string_view & |
str, |
|
|
const std::string_view & |
a, |
|
|
const std::string_view & |
b, |
|
|
const size_t & |
pos = 0 |
|
) |
| |
|
static |
Extract a substring between two markers from the original string.
Extracts the content from a to b (excluding a and b), and a starting search position can be specified. If a or b is an empty string, it means from the beginning or to the end, respectively. If a is not found, it defaults to starting from the beginning. If b is not found, it defaults to the end.
- Parameters
-
| ori_str | Original string. |
| str | String to store the extraction result. |
| a | Start marker string. |
| b | End marker string. |
| pos | Starting search position. |
- Returns
- Returns the position of b in ori_str (may return string::npos if b is not found or b is "")
- Note
- If not found, the result string is ""
| static size_t stt::data::HttpStringUtil::get_split_str |
( |
const std::string_view & |
ori_str, |
|
|
std::string & |
str, |
|
|
const std::string_view & |
a, |
|
|
const std::string_view & |
b, |
|
|
const size_t & |
pos = 0 |
|
) |
| |
|
static |
Extract a substring between two markers from the original string.
Extracts the content from a to b (excluding a and b), and a starting search position can be specified. If a or b is an empty string, it means from the beginning or to the end, respectively. If a is not found, it defaults to starting from the beginning. If b is not found, it defaults to the end.
- Parameters
-
| ori_str | Original string. |
| str | String to store the extraction result. |
| a | Start marker string. |
| b | End marker string. |
| pos | Starting search position. |
- Returns
- Returns the position of b in ori_str (may return string::npos if b is not found or b is "")
- Note
- If not found, the result string is ""