Browse Source

add is_i2p

pull/978/head
Jeff Becker 8 years ago committed by Jeff Becker
parent
commit
1500e805dd
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
  1. 5
      libi2pd/HTTP.cpp
  2. 7
      libi2pd/HTTP.h

5
libi2pd/HTTP.cpp

@ -195,6 +195,11 @@ namespace http { @@ -195,6 +195,11 @@ namespace http {
return out;
}
bool URL::is_i2p() const
{
return host.rfind(".i2p") == ( host.size() - 4 );
}
void HTTPMsg::add_header(const char *name, std::string & value, bool replace) {
add_header(name, value.c_str(), replace);
}

7
libi2pd/HTTP.h

@ -56,6 +56,11 @@ namespace http @@ -56,6 +56,11 @@ namespace http
* @note Returns relative url if schema if empty, absolute url otherwise
*/
std::string to_string ();
/**
* @brief return true if the host is inside i2p
*/
bool is_i2p() const;
};
struct HTTPMsg
@ -89,7 +94,7 @@ namespace http @@ -89,7 +94,7 @@ namespace http
/** @brief Serialize HTTP request to string */
std::string to_string();
void write(std::ostream & o);
void write(std::ostream & o);
void AddHeader (const std::string& name, const std::string& value);
void UpdateHeader (const std::string& name, const std::string& value);

Loading…
Cancel
Save