made to_string const

This commit is contained in:
orignal
2026-07-06 21:14:41 -04:00
parent c2b5762fd7
commit 06510d5e6a
2 changed files with 7 additions and 8 deletions
+4 -3
View File
@@ -230,7 +230,8 @@ namespace http
return true;
}
std::string URL::to_string() {
std::string URL::to_string() const
{
std::string out = "";
if (schema != "") {
out = schema + "://";
@@ -349,7 +350,7 @@ namespace http
return eoh + HTTP_EOH.length();
}
void HTTPReq::write(std::ostream & o)
void HTTPReq::write(std::ostream & o) const
{
o << method << " " << uri << " " << version << CRLF;
for (auto & h : headers)
@@ -357,7 +358,7 @@ namespace http
o << CRLF;
}
std::string HTTPReq::to_string()
std::string HTTPReq::to_string() const
{
std::stringstream ss;
write(ss);
+3 -5
View File
@@ -68,7 +68,7 @@ namespace http
* @brief Serialize URL structure to url
* @note Returns relative url if schema if empty, absolute url otherwise
*/
std::string to_string ();
std::string to_string () const;
/**
* @brief return true if the host is inside i2p
@@ -107,8 +107,8 @@ namespace http
int parse(std::string_view buf);
/** @brief Serialize HTTP request to string */
std::string to_string();
void write(std::ostream & o);
std::string to_string() const;
void write(std::ostream & o) const;
void AddHeader (const std::string& name, const std::string& value);
void UpdateHeader (const std::string& name, const std::string& value);
@@ -151,8 +151,6 @@ namespace http
*/
std::string to_string();
void write(std::ostream & o);
/** @brief Checks that response declared as chunked data */
bool is_chunked() const ;