void SessionFactory::processFixDataDictionary(const SessionID& sessionID, const Dictionary& settings, DataDictionaryProvider& provider) throw(ConfigError) { const DataDictionary * pDataDictionary = createDataDictionary(sessionID, settings, DATA_DICTIONARY); provider.addTransportDataDictionary(sessionID.getBeginString(), pDataDictionary); provider.addApplicationDataDictionary(Message::toApplVerID(sessionID.getBeginString()), pDataDictionary); }
//------------------------------------------------------------------------------------------------- void Session::compid_check(const unsigned seqnum, const Message *msg, const SessionID& id) const { if (_loginParameters._enforce_compids) { if (!id.same_sender_comp_id(msg->Header()->get<target_comp_id>()->get())) throw BadCompidId(msg->Header()->get<target_comp_id>()->get()); if (!id.same_target_comp_id(msg->Header()->get<sender_comp_id>()->get())) throw BadCompidId(msg->Header()->get<sender_comp_id>()->get()); } }
void NetworkProcess::deleteWebsiteData(SessionID sessionID, uint64_t websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID) { #if PLATFORM(COCOA) if (websiteDataTypes & WebsiteDataTypeHSTSCache) { if (auto* networkStorageSession = SessionTracker::storageSession(sessionID)) clearHSTSCache(*networkStorageSession, modifiedSince); } #endif if (websiteDataTypes & WebsiteDataTypeCookies) { if (auto* networkStorageSession = SessionTracker::storageSession(sessionID)) deleteAllCookiesModifiedSince(*networkStorageSession, modifiedSince); } auto completionHandler = [this, callbackID] { parentProcessConnection()->send(Messages::NetworkProcessProxy::DidDeleteWebsiteData(callbackID), 0); }; if ((websiteDataTypes & WebsiteDataTypeDiskCache) && !sessionID.isEphemeral()) { clearDiskCache(modifiedSince, WTFMove(completionHandler)); return; } completionHandler(); }
void AsioSocketInitiator::ConnectSession( const SessionID& s, const Dictionary& d ) { std::string address; short port = 0; Session* session = Session::lookupSession( s ); assert ( session != 0 ) ; if( !session->isSessionTime(UtcTimeStamp()) ) return; getHost( s, d, address, port ); boost::shared_ptr < boost::asio::ip::tcp::socket > socket ( new boost::asio::ip::tcp::socket ( m_service ) ); boost::asio::ip::tcp::resolver::query query ( boost::asio::ip::tcp::v4(), address, boost::lexical_cast < std::string > ( port ) ); boost::asio::ip::tcp::resolver resolver ( m_service ); boost::system::error_code ec; boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve ( query, ec ); if ( ec != 0 ) throw new std::runtime_error ( ( boost::format ( "Unable to resolve [%1%][%2%]" ) % address % port ).str().c_str() ); assert ( socket.get() != 0 ); // we could have done this async, but it's easier this way .. socket->connect ( *iterator, ec ); if ( ec != 0 ) throw new std::runtime_error ( ( boost::format ( "Unable to connect to [%1%][%2%]" ) % address % port ).str().c_str() ); AsioSocketConnection_ptr connection ( boost::make_shared < AsioSocketConnection > ( socket, s, session ) ); m_connections.insert ( std::make_pair ( s.toString(), connection ) ); }
void SessionFactory::processFixtDataDictionaries(const SessionID& sessionID, const Dictionary& settings, DataDictionaryProvider& provider) throw(ConfigError) { DataDictionary dataDictionary = createDataDictionary(sessionID, settings, TRANSPORT_DATA_DICTIONARY); provider.addTransportDataDictionary(sessionID.getBeginString(), dataDictionary); for(Dictionary::const_iterator data = settings.begin(); data != settings.end(); ++data) { const std::string& key = data->first; const std::string frontKey = key.substr(0, strlen(APP_DATA_DICTIONARY)); if( frontKey == string_toUpper(APP_DATA_DICTIONARY) ) { if( key == string_toUpper(APP_DATA_DICTIONARY) ) { DataDictionary dataDictionary = createDataDictionary(sessionID, settings, APP_DATA_DICTIONARY); provider.addApplicationDataDictionary(Message::toApplVerID(settings.getString(DEFAULT_APPLVERID)), dataDictionary); } else { std::string::size_type offset = key.find('.'); if( offset == std::string::npos ) throw ConfigError(std::string("Malformed ") + APP_DATA_DICTIONARY + ": " + key); std::string beginStringQualifier = key.substr(offset+1); DataDictionary dataDictionary = createDataDictionary(sessionID, settings, key); provider.addApplicationDataDictionary(Message::toApplVerID(beginStringQualifier), dataDictionary); } } } }
// FIXME: For this constructor, we should probably mandate that the URL has no fragment identifier. CachedResource::CachedResource(const URL& url, Type type, SessionID sessionID) : m_resourceRequest(url) , m_decodedDataDeletionTimer(*this, &CachedResource::destroyDecodedData, deadDecodedDataDeletionIntervalForResourceType(type)) , m_sessionID(sessionID) , m_responseTimestamp(std::chrono::system_clock::now()) , m_fragmentIdentifierForRequest(CachedResourceRequest::splitFragmentIdentifierFromRequestURL(m_resourceRequest)) , m_type(type) , m_status(Cached) { ASSERT(sessionID.isValid()); #ifndef NDEBUG cachedResourceLeakCounter.increment(); #endif }
FileStore::FileStore( std::string path, const SessionID& s ) : m_msgFile( 0 ), m_headerFile( 0 ), m_seqNumsFile( 0 ), m_sessionFile( 0 ) { file_mkdir( path.c_str() ); if ( path.empty() ) path = "."; const std::string& begin = s.getBeginString().getString(); const std::string& sender = s.getSenderCompID().getString(); const std::string& target = s.getTargetCompID().getString(); const std::string& qualifier = s.getSessionQualifier(); std::string sessionid = begin + "-" + sender + "-" + target; if( qualifier.size() ) sessionid += "-" + qualifier; std::string prefix = file_appendpath(path, sessionid + "."); m_msgFileName = prefix + "body"; m_headerFileName = prefix + "header"; m_seqNumsFileName = prefix + "seqnums"; m_sessionFileName = prefix + "session"; try { open( false ); } catch ( IOException & e ) { throw ConfigError( e.what() ); } }
CachedResource::CachedResource(const ResourceRequest& request, Type type, SessionID sessionID) : m_resourceRequest(request) , m_sessionID(sessionID) , m_loadPriority(defaultPriorityForResourceType(type)) , m_responseTimestamp(currentTime()) , m_decodedDataDeletionTimer(this, &CachedResource::decodedDataDeletionTimerFired, deadDecodedDataDeletionIntervalForResourceType(type)) , m_lastDecodedAccessTime(0) , m_loadFinishTime(0) , m_encodedSize(0) , m_decodedSize(0) , m_accessCount(0) , m_handleCount(0) , m_preloadCount(0) , m_preloadResult(PreloadNotReferenced) , m_inLiveDecodedResourcesList(false) , m_requestedFromNetworkingLayer(false) , m_inCache(false) , m_loading(false) , m_switchingClientsToRevalidatedResource(false) , m_type(type) , m_status(Pending) #ifndef NDEBUG , m_deleted(false) , m_lruIndex(0) #endif , m_nextInAllResourcesList(0) , m_prevInAllResourcesList(0) , m_nextInLiveResourcesList(0) , m_prevInLiveResourcesList(0) , m_owningCachedResourceLoader(0) , m_resourceToRevalidate(0) , m_proxyResource(0) { ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests careless updates of the enum. ASSERT(sessionID.isValid()); #ifndef NDEBUG cachedResourceLeakCounter.increment(); #endif if (!m_resourceRequest.url().hasFragmentIdentifier()) return; URL urlForCache = MemoryCache::removeFragmentIdentifierIfNeeded(m_resourceRequest.url()); if (urlForCache.hasFragmentIdentifier()) return; m_fragmentIdentifierForRequest = m_resourceRequest.url().fragmentIdentifier(); m_resourceRequest.setURL(urlForCache); }
void NetworkProcess::deleteWebsiteDataForOrigins(SessionID sessionID, uint64_t websiteDataTypes, const Vector<SecurityOriginData>& origins, const Vector<String>& cookieHostNames, uint64_t callbackID) { if (websiteDataTypes & WebsiteDataTypeCookies) { if (auto* networkStorageSession = SessionTracker::storageSession(sessionID)) deleteCookiesForHostnames(*networkStorageSession, cookieHostNames); } auto completionHandler = [this, callbackID] { parentProcessConnection()->send(Messages::NetworkProcessProxy::DidDeleteWebsiteDataForOrigins(callbackID), 0); }; if ((websiteDataTypes & WebsiteDataTypeDiskCache) && !sessionID.isEphemeral()) { clearDiskCacheEntries(origins, WTFMove(completionHandler)); return; } completionHandler(); }
CachedResource::CachedResource(CachedResourceRequest&& request, Type type, SessionID sessionID) : m_resourceRequest(request.releaseResourceRequest()) , m_options(request.options()) , m_decodedDataDeletionTimer(*this, &CachedResource::destroyDecodedData, deadDecodedDataDeletionIntervalForResourceType(type)) , m_sessionID(sessionID) , m_loadPriority(defaultPriorityForResourceType(type)) , m_responseTimestamp(std::chrono::system_clock::now()) , m_fragmentIdentifierForRequest(request.releaseFragmentIdentifier()) , m_origin(request.releaseOrigin()) , m_type(type) { ASSERT(sessionID.isValid()); setLoadPriority(request.priority()); #ifndef NDEBUG cachedResourceLeakCounter.increment(); #endif // FIXME: We should have a better way of checking for Navigation loads, maybe FetchMode::Options::Navigate. ASSERT(m_origin || m_type == CachedResource::MainResource); if (isRequestCrossOrigin(m_origin.get(), m_resourceRequest.url(), m_options)) setCrossOrigin(); }
void Message::setSessionID( const SessionID& sessionID ) { getHeader().setField( sessionID.getBeginString() ); getHeader().setField( sessionID.getSenderCompID() ); getHeader().setField( sessionID.getTargetCompID() ); }