Poco::Net::WebSocket* DefaultWebSocketFactory::createWebSocket(const Poco::URI& uri, Poco::Net::HTTPRequest& request, Poco::Net::HTTPResponse& response) { Poco::SharedPtr<Poco::Net::HTTPClientSession> pSession = Poco::Net::HTTPSessionFactory::defaultFactory().createClientSession(uri); pSession->setTimeout(_timeout); if (!_username.empty()) { Poco::Net::HTTPBasicCredentials creds(_username, _password); creds.authenticate(request); } return new Poco::Net::WebSocket(*pSession, request, response); }
void Package::FireLoadEvent(const IRI &url) const { if ( _loadEventHandler == nullptr ) throw std::runtime_error(_Str("No load event handler installed to load '", url.URIString(), "'")); if ( url.Path().find(_pathBase) == 0 ) { _loadEventHandler(url); return; } IRI fixed(IRI::gEPUBScheme, UniqueID(), _pathBase, url.Query(), url.Fragment()); fixed.AddPathComponent(url.Path()); IRI::IRICredentials creds(url.Credentials()); fixed.SetCredentials(creds.first, creds.second); _loadEventHandler(fixed); }