bool ResourceLoader::init(const ResourceRequest& r) { ASSERT(!m_handle); ASSERT(m_request.isNull()); ASSERT(m_deferredRequest.isNull()); ASSERT(!m_documentLoader->isSubstituteLoadPending(this)); ResourceRequest clientRequest(r); m_defersLoading = m_frame->page()->defersLoading(); if (m_options.securityCheck == DoSecurityCheck && !m_frame->document()->securityOrigin()->canDisplay(clientRequest.url())) { FrameLoader::reportLocalLoadFailed(m_frame.get(), clientRequest.url().string()); releaseResources(); return false; } // https://bugs.webkit.org/show_bug.cgi?id=26391 // The various plug-in implementations call directly to ResourceLoader::load() instead of piping requests // through FrameLoader. As a result, they miss the FrameLoader::addExtraFieldsToRequest() step which sets // up the 1st party for cookies URL. Until plug-in implementations can be reigned in to pipe through that // method, we need to make sure there is always a 1st party for cookies set. if (clientRequest.firstPartyForCookies().isNull()) { if (Document* document = m_frame->document()) clientRequest.setFirstPartyForCookies(document->firstPartyForCookies()); } willSendRequest(clientRequest, ResourceResponse()); if (clientRequest.isNull()) { cancel(); return false; } m_originalRequest = m_request = clientRequest; return true; }
bool ResourceLoader::load(const ResourceRequest& r) { ASSERT(!m_handle); ASSERT(m_deferredRequest.isNull()); ASSERT(!m_documentLoader->isSubstituteLoadPending(this)); ResourceRequest clientRequest(r); willSendRequest(clientRequest, ResourceResponse()); if (clientRequest.isNull()) { didFail(frameLoader()->cancelledError(r)); return false; } if (m_documentLoader->scheduleArchiveLoad(this, clientRequest, r.url())) return true; #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (m_documentLoader->applicationCacheHost()->maybeLoadResource(this, clientRequest, r.url())) return true; #endif if (m_defersLoading) { m_deferredRequest = clientRequest; return true; } m_handle = ResourceHandle::create(clientRequest, this, m_frame.get(), m_defersLoading, m_shouldContentSniff, true); return true; }
bool ResourceLoader::load(const ResourceRequest& r) { ASSERT(!m_handle); ASSERT(m_deferredRequest.isNull()); ASSERT(!frameLoader()->isArchiveLoadPending(this)); m_originalURL = r.url(); ResourceRequest clientRequest(r); willSendRequest(clientRequest, ResourceResponse()); if (clientRequest.isNull()) { didFail(frameLoader()->cancelledError(r)); return false; } if (frameLoader()->willUseArchive(this, clientRequest, m_originalURL)) return true; if (m_defersLoading) { m_deferredRequest = clientRequest; return true; } m_handle = ResourceHandle::create(clientRequest, this, m_frame.get(), m_defersLoading, m_shouldContentSniff, true); return true; }
bool ResourceLoader::init(const ResourceRequest& r) { ASSERT(!m_handle); ASSERT(m_request.isNull()); ASSERT(m_deferredRequest.isNull()); ASSERT(!m_documentLoader->isSubstituteLoadPending(this)); ResourceRequest clientRequest(r); // https://bugs.webkit.org/show_bug.cgi?id=26391 // The various plug-in implementations call directly to ResourceLoader::load() instead of piping requests // through FrameLoader. As a result, they miss the FrameLoader::addExtraFieldsToRequest() step which sets // up the 1st party for cookies URL. Until plug-in implementations can be reigned in to pipe through that // method, we need to make sure there is always a 1st party for cookies set. if (clientRequest.firstPartyForCookies().isNull()) { if (Document* document = m_frame->document()) clientRequest.setFirstPartyForCookies(document->firstPartyForCookies()); } m_request = clientRequest; willSendRequest(m_request, ResourceResponse()); if (m_request.isNull()) { didFail(frameLoader()->cancelledError(m_request)); return false; } return true; }
bool ResourceLoader::init(const ResourceRequest& r) { ResourceRequest clientRequest(r); willSendRequest(clientRequest, ResourceResponse()); m_request = clientRequest; return true; }
bool ResourceLoader::init(const ResourceRequest& r) { ASSERT(!m_handle); ASSERT(m_request.isNull()); ASSERT(m_deferredRequest.isNull()); ASSERT(!m_documentLoader->isSubstituteLoadPending(this)); ResourceRequest clientRequest(r); m_loadTiming.markStartTimeAndFetchStart(); #if PLATFORM(IOS) // If the documentLoader was detached while this ResourceLoader was waiting its turn // in ResourceLoadScheduler queue, don't continue. if (!m_documentLoader->frame()) { cancel(); return false; } #endif m_defersLoading = m_options.defersLoadingPolicy == DefersLoadingPolicy::AllowDefersLoading && m_frame->page()->defersLoading(); if (m_options.securityCheck == DoSecurityCheck && !m_frame->document()->securityOrigin()->canDisplay(clientRequest.url())) { FrameLoader::reportLocalLoadFailed(m_frame.get(), clientRequest.url().string()); releaseResources(); return false; } // https://bugs.webkit.org/show_bug.cgi?id=26391 // The various plug-in implementations call directly to ResourceLoader::load() instead of piping requests // through FrameLoader. As a result, they miss the FrameLoader::addExtraFieldsToRequest() step which sets // up the 1st party for cookies URL. Until plug-in implementations can be reigned in to pipe through that // method, we need to make sure there is always a 1st party for cookies set. if (clientRequest.firstPartyForCookies().isNull()) { if (Document* document = m_frame->document()) clientRequest.setFirstPartyForCookies(document->firstPartyForCookies()); } willSendRequestInternal(clientRequest, ResourceResponse()); #if PLATFORM(IOS) // If this ResourceLoader was stopped as a result of willSendRequest, bail out. if (m_reachedTerminalState) return false; #endif if (clientRequest.isNull()) { cancel(); return false; } m_originalRequest = m_request = clientRequest; return true; }
void main( int argc, char **argv ) { SOCKET sock; int arg; char *host = DEFAULT_HOST; u_short port = (u_short)DEFAULT_PORT; for( arg = 1; arg < argc; arg++ ) { if ( argv[ arg ][0] != '-' ) { fprintf( stderr, "Invalid command line argument: %s\n", argv[ arg ] ); exit(1); } switch( argv[ arg ][1] ) { case 'h': printf( "-t <host>\tTarget host name (default 'localhost')\n" ); printf( "-p <port>\tTarget port number (default 16903)\n" ); printf( "-e\t\tAES Mode ECB\n" ); printf( "-v\t\tVerbose\n" ); exit(0); case 't' : host = argv[ ++arg ]; break; case 'p' : port = atoi( argv[ ++arg ] ); break; case 'e' : sessKeyMode = CRYPT_MODE_ECB; break; case 'v' : verbose = TRUE; break; default: fprintf( stderr, "Invalid command line flag: %s\n", argv[ arg ] ); exit(1); } } if ( ! initCrypt() ) exit(1); sock = tcpConnect( host, port ); if ( ! initSession( sock ) ) exit(1); if ( ! clientRequest( sock, host, port ) ) exit(1); shutdown( sock, 2 ); closesocket( sock ); if ( WSACleanup() == SOCKET_ERROR ) fprintf( stderr, "Problem with socket cleanup\n" ); termCrypt(); exit(0); }
bool ResourceLoader::load(const ResourceRequest& r) { ASSERT(!m_handle); ASSERT(m_deferredRequest.isNull()); ASSERT(!m_documentLoader->isSubstituteLoadPending(this)); ResourceRequest clientRequest(r); // https://bugs.webkit.org/show_bug.cgi?id=26391 // The various plug-in implementations call directly to ResourceLoader::load() instead of piping requests // through FrameLoader. As a result, they miss the FrameLoader::addExtraFieldsToRequest() step which sets // up the 1st party for cookies URL. Until plug-in implementations can be reigned in to pipe through that // method, we need to make sure there is always a 1st party for cookies set. if (clientRequest.firstPartyForCookies().isNull()) { if (Document* document = m_frame->document()) clientRequest.setFirstPartyForCookies(document->firstPartyForCookies()); } willSendRequest(clientRequest, ResourceResponse()); if (clientRequest.isNull()) { didFail(frameLoader()->cancelledError(r)); return false; } if (m_documentLoader->scheduleArchiveLoad(this, clientRequest, r.url())) return true; #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (m_documentLoader->applicationCacheHost()->maybeLoadResource(this, clientRequest, r.url())) return true; // Based on http://www.w3.org/TR/html5/offline.html, any urls listed in FALLBACK or NETWORK should bypass cache. if (m_documentLoader->applicationCacheHost()->isFallbackOrNetworkResource(clientRequest.url())) clientRequest.setCachePolicy(ReloadIgnoringCacheData); #endif if (m_defersLoading) { m_deferredRequest = clientRequest; return true; } m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), clientRequest, this, m_defersLoading, m_shouldContentSniff); return true; }
bool ResourceLoader::init(const ResourceRequest& r) { ASSERT(!m_handle); ASSERT(m_request.isNull()); ASSERT(m_deferredRequest.isNull()); ResourceRequest clientRequest(r); willSendRequest(0, clientRequest, ResourceResponse()); if (clientRequest.isNull()) { cancel(); return false; } ASSERT(m_state != Terminated); m_originalRequest = m_request = clientRequest; m_state = Initialized; m_documentLoader->addResourceLoader(this); return true; }
/* Convenience method to issue a client http request. Assumes the Mpr and Http services are created and initialized. */ PUBLIC HttpStream *httpRequest(cchar *method, cchar *uri, cchar *data, int protocol, char **err) { HttpNet *net; HttpStream *stream; MprDispatcher *dispatcher; assert(err); dispatcher = mprCreateDispatcher("httpRequest", MPR_DISPATCHER_AUTO); mprStartDispatcher(dispatcher); net = httpCreateNet(dispatcher, NULL, protocol, 0); if ((stream = httpCreateStream(net, 0)) == 0) { return 0; } mprAddRoot(stream); if (clientRequest(stream, method, uri, data, protocol, err) < 0) { mprRemoveRoot(stream); httpDestroyNet(net); return 0; } mprRemoveRoot(stream); return stream; }