replace more strings to string_view

This commit is contained in:
orignal 2025-03-15 16:43:08 -04:00
parent 67ab4fef6d
commit 960a85e415
2 changed files with 16 additions and 15 deletions
libi2pd

View file

@ -21,8 +21,8 @@ namespace i2p
{
namespace http
{
const char CRLF[] = "\r\n"; /**< HTTP line terminator */
const char HTTP_EOH[] = "\r\n\r\n"; /**< HTTP end-of-headers mark */
constexpr std::string_view CRLF = "\r\n"; /**< HTTP line terminator */
constexpr std::string_view HTTP_EOH = "\r\n\r\n"; /**< HTTP end-of-headers mark */
struct URL
{
@ -101,8 +101,8 @@ namespace http
void UpdateHeader (const std::string& name, const std::string& value);
void RemoveHeader (const std::string& name, const std::string& exempt); // remove all headers starting with name, but exempt
void RemoveHeader (const std::string& name) { RemoveHeader (name, ""); };
std::string GetHeader (const std::string& name) const;
size_t GetNumHeaders (const std::string& name) const;
std::string GetHeader (std::string_view name) const;
size_t GetNumHeaders (std::string_view name) const;
size_t GetNumHeaders () const { return headers.size (); };
};
@ -152,7 +152,7 @@ namespace http
* @param code HTTP code [100, 599]
* @return Immutable string with status
*/
const char * HTTPCodeToStatus(int code);
std::string_view HTTPCodeToStatus(int code);
/**
* @brief Replaces %-encoded characters in string with their values