void HTTPSocket::url_this(const std::string& url_in,std::string& protocol,std::string& host,port_t& port,std::string& url,std::string& file) { Parse pa(url_in,"/"); protocol = pa.getword(); // http if (!strcasecmp(protocol.c_str(), "https:")) { #ifdef HAVE_OPENSSL EnableSSL(); #else Handler().LogError(this, "url_this", -1, "SSL not available", LOG_LEVEL_WARNING); #endif port = 443; } else { port = 80; } host = pa.getword(); if (strstr(host.c_str(),":")) { Parse pa(host,":"); pa.getword(host); port = static_cast<port_t>(pa.getvalue()); } url = "/" + pa.getrest(); { Parse pa(url,"/"); std::string tmp = pa.getword(); while (tmp.size()) { file = tmp; tmp = pa.getword(); } } } // url_this
MySocket(ISocketHandler& h,bool one) : TcpSocket(h), m_b_client(false), m_b_one(one), m_b_created(false), m_b_active(false) { gettime(&m_create, NULL); SetLineProtocol(); #ifdef HAVE_OPENSSL if (g_b_ssl) EnableSSL(); #endif if (g_max_connections && !m_b_one && Handler().GetCount() >= g_max_connections) { fprintf(stderr, "\nConnection limit reached: %d, continuing in single connection stress mode\n", (int)g_max_connections); if (g_b_off) printreport_reset(); g_b_limit = true; m_b_one = true; // g_b_flood = g_b_repeat; } #ifndef USE_EPOLL if (!m_b_one && Handler().GetCount() >= Handler().MaxCount() - 17) { fprintf(stderr, "\nFD_SETSIZE connection limit reached: %d, continuing in single connection stress mode\n", (int)Handler().GetCount()); if (g_b_off) printreport_reset(); g_b_limit = true; m_b_one = true; // g_b_flood = g_b_repeat; } #endif }
void StatusSocket::Init() { if (GetParent() -> GetPort() == 2222) { EnableSSL(); } }
MySocket(ISocketHandler& h) : TcpSocket(h) { SetLineProtocol(); #ifdef HAVE_OPENSSL if (g_b_ssl) EnableSSL(); #endif if (g_b_nobuf) DisableInputBuffer(); }
void HttpDebugSocket::Init() { if (GetParent() -> GetPort() == 443) { #ifdef HAVE_OPENSSL EnableSSL(); #else Handler().LogError(this, "url_this", -1, "SSL not available", LOG_LEVEL_WARNING); #endif } }
TestSocket(class EventHandler& h, bool add = false) : TcpSocket(h), IEventOwner(h) , m_req_index(0) { if (https) { EnableSSL(); } if (add) { m_event_open = AddEvent(interval / 1000, (interval % 1000) * 1000); } }
void HTTPSocket::url_this(const std::string& url_in,std::string& protocol,std::string& host,port_t& port,std::string& url,std::string& file) { Parse pa(url_in,"/"); std::string user; std::string auth; protocol = pa.getword(); // http if (!strcasecmp(protocol.c_str(), "https:")) { #ifdef HAVE_OPENSSL EnableSSL(); #else Handler().LogError(this, "url_this", -1, "SSL not available", LOG_LEVEL_WARNING); #endif port = 443; } else { port = 80; } host = pa.getword(); size_t pos = host.find("@"); if (pos != std::string::npos) { user = host.substr(0, pos); host = host.substr(pos + 1); if (user.find(":") != std::string::npos) { AddResponseHeader("Authorization", "Basic " + Utility::base64(user)); } } if (strstr(host.c_str(),":")) { Parse pa(host,":"); pa.getword(host); port = static_cast<port_t>(pa.getvalue()); } url = "/" + pa.getrest(); { Parse pa(url,"/"); std::string tmp = pa.getword(); while (tmp.size()) { file = tmp; tmp = pa.getword(); } } } // url_this
tSocket(ISocketHandler& h) : HTTPSocket(h) , m_first(false) , m_sz(0) { EnableSSL(); }
tSocket(ISocketHandler& h, const std::string& host) : HTTPSocket(h), m_host(host) , m_first(false) , m_sz(0) { EnableSSL(); Open(host, 4443); }