diff options
Diffstat (limited to 'net/http')
26 files changed, 39 insertions, 1175 deletions
diff --git a/net/http/http_basic_stream.cc b/net/http/http_basic_stream.cc index f74614b..6501a59 100644 --- a/net/http/http_basic_stream.cc +++ b/net/http/http_basic_stream.cc @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -34,7 +33,7 @@ int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info, DCHECK(!parser_.get()); request_info_ = request_info; parser_.reset(new HttpStreamParser(connection_.get(), request_info, - read_buf_, net_log, using_proxy_)); + read_buf_, net_log)); return OK; } diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 4a2313c..d53d525 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,9 +35,6 @@ #include "net/http/http_util.h" #include "net/socket/ssl_host_info.h" -#include "net/disk_cache/stat_hub.h" -#include "net/disk_cache/hostres_plugin_bridge.h" - namespace net { namespace { @@ -89,14 +85,8 @@ HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) { int HttpCache::DefaultBackend::CreateBackend(NetLog* net_log, disk_cache::Backend** backend, - CompletionCallback* callback, - FilePath** stat_db_path) { + CompletionCallback* callback) { DCHECK_GE(max_bytes_, 0); - (*stat_db_path) = NULL; - if (type_ == net::DISK_CACHE) { - std::string dataPath = "/data/data/"; - (*stat_db_path) = new FilePath(dataPath + stat_hub::kEnabledAppName + "/databases"); - } return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true, thread_, net_log, backend, callback); } @@ -349,8 +339,7 @@ HttpCache::HttpCache(HostResolver* host_resolver, http_auth_handler_factory, network_delegate, net_log))), - ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) - , stat_db_path_(NULL) { + ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { } @@ -419,10 +408,6 @@ HttpCache::~HttpCache() { if (delete_pending_op) delete pending_op; } - - if (NULL!=stat_db_path_) { - delete stat_db_path_; - } } int HttpCache::GetBackend(disk_cache::Backend** backend, @@ -533,7 +518,7 @@ int HttpCache::CreateBackend(disk_cache::Backend** backend, pending_op->callback = my_callback; int rv = backend_factory_->CreateBackend(net_log_, &pending_op->backend, - my_callback, &stat_db_path_ ); + my_callback); if (rv != ERR_IO_PENDING) { pending_op->writer->ClearCallback(); my_callback->Run(rv); @@ -1158,21 +1143,8 @@ void HttpCache::OnBackendCreated(int result, PendingOp* pending_op) { } // The cache may be gone when we return from the callback. - if (!item->DoCallback(result, backend)) { + if (!item->DoCallback(result, backend)) item->NotifyTransaction(result, NULL); - if (NULL!=stat_db_path_) { - if(!stat_hub::StatHub::GetInstance()->IsReady()) { - stat_hub::StatProcessor* hp = StatHubCreateHostResPlugin(); - if (NULL!=hp) { - stat_hub::StatHub::GetInstance()->RegisterProcessor(hp); - LOG(INFO) << "HttpCache::OnBackendCreated HostStat created"; - } - if(stat_hub::StatHub::GetInstance()->Init(stat_db_path_->value(), MessageLoop::current(), this)) { - LOG(INFO) << "HttpCache::OnBackendCreated : StatHub is ready."; - } - } - } - } } } // namespace net diff --git a/net/http/http_cache.h b/net/http/http_cache.h index 2ff5eff..0c2dc35 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h @@ -1,6 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, Code Aurora Forum. All rights reserved - // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -90,8 +88,7 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory, // |callback| because the object can be deleted from within the callback. virtual int CreateBackend(NetLog* net_log, disk_cache::Backend** backend, - CompletionCallback* callback, - FilePath** stat_db_path) = 0; + CompletionCallback* callback) = 0; }; // A default backend factory for the common use cases. @@ -110,8 +107,7 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory, // BackendFactory implementation. virtual int CreateBackend(NetLog* net_log, disk_cache::Backend** backend, - CompletionCallback* callback, - FilePath** stat_db_path); + CompletionCallback* callback); private: CacheType type_; @@ -382,8 +378,6 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory, scoped_ptr<PlaybackCacheMap> playback_cache_map_; - FilePath* stat_db_path_; - DISALLOW_COPY_AND_ASSIGN(HttpCache); }; diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 3fef3a7..a12a64f 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, 2012 Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -35,8 +34,6 @@ #include "net/http/http_transaction.h" #include "net/http/http_util.h" #include "net/http/partial_data.h" -#include "net/http/preconnect.h" -#include "net/http/net-plugin-bridge.h" using base::Time; @@ -1646,17 +1643,13 @@ bool HttpCache::Transaction::RequiresValidation() { return true; if (response_.headers->RequiresValidation( - response_.request_time, response_.response_time, Time::Now())) { - ObserveRevalidation(&response_, request_, cache_); + response_.request_time, response_.response_time, Time::Now())) return true; - } // Since Vary header computation is fairly expensive, we save it for last. if (response_.vary_data.is_valid() && - !response_.vary_data.MatchesRequest(*request_, *response_.headers)) { - ObserveRevalidation(&response_, request_, cache_); + !response_.vary_data.MatchesRequest(*request_, *response_.headers)) return true; - } return false; } diff --git a/net/http/http_getzip_bridge.cc b/net/http/http_getzip_bridge.cc deleted file mode 100644 index 9395c1e..0000000 --- a/net/http/http_getzip_bridge.cc +++ /dev/null @@ -1,142 +0,0 @@ -/** - * Copyright (c) 2012, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other *materials provided - * with the distribution. - * * Neither the name of Code Aurora Forum, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - **/ - -#include "net/http/http_getzip_bridge.h" -#include "net/http/http_request_headers.h" -#include "net/http/http_response_headers.h" - -namespace net -{ - -void GetNextHttpRequestHeader( void*& it) -{ - if (NULL == it)return; - - HttpRequestHeaders::Iterator* myIt = - (static_cast<HttpRequestHeaders::Iterator*> (it)); - - if (!myIt->GetNext()) - { - delete myIt; - it = NULL; - } -} - -void GetFirstHttpRequestHeader( - net::HttpRequestHeaders& req, void*& it) -{ - //create a new Iterator for the req - it = new net::HttpRequestHeaders::Iterator(req); - return GetNextHttpRequestHeader( it ); -} - -const std::string& GetHttpRequestHeaderName( void*& it ) -{ - net::HttpRequestHeaders::Iterator* myIt = - (static_cast<net::HttpRequestHeaders::Iterator*> (it)); - return myIt->name(); -} - -const std::string& GetHttpRequestHeaderValue( void*& it ) -{ - net::HttpRequestHeaders::Iterator* myIt = - (static_cast<net::HttpRequestHeaders::Iterator*> (it)); - return myIt->value(); -} - -bool GetHttpRequestHeaderByValue( - net::HttpRequestHeaders& req, - const std::string& headerName, - std::string* headerValue) -{ - return req.GetHeader(headerName, headerValue); -} - -void SetHttpRequestHeader(net::HttpRequestHeaders& req, - const std::string& headerName, const std::string& value) -{ - req.SetHeader(headerName, value); -} - -void RemoveHttpRequestHeader(net::HttpRequestHeaders& req, - const std::string& headerName) -{ - req.RemoveHeader(headerName); -} - -void RemoveHttpResponseHeader(net::HttpResponseHeaders* res, - const std::string& headerName) -{ - if (NULL == res) - return; - - res->RemoveHeader(headerName); -} - -std::string GetHttpResponseHeaderValue(net::HttpResponseHeaders* res, - const std::string& headerName) -{ - if (NULL == res) - return ""; - std::string value; - - void* iter = NULL; - std::string temp; - while (res->EnumerateHeader(&iter, headerName, &temp)) { - - value.append(temp); - value.append(", "); - } - if(value.size() > 2) - { - value.erase(value.size() - 2); - } - - return value; -} - -int GetHttpResponseCode(net::HttpResponseHeaders* res) -{ - if(NULL == res) return -1; - - return res->response_code(); -} - -bool HasHttpResponseHeader(net::HttpResponseHeaders* res, - const std::string& headerName) -{ - if(NULL == res) return false; - - return res->HasHeader(headerName); -} - -void initBridge(){ } - -}; //end net - diff --git a/net/http/http_getzip_bridge.h b/net/http/http_getzip_bridge.h deleted file mode 100644 index c545b89..0000000 --- a/net/http/http_getzip_bridge.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2012, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other *materials provided - * with the distribution. - * * Neither the name of Code Aurora Forum, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - **/ - -#ifndef HTTP_GETZIP_BRIDGE_H_ -#define HTTP_GETZIP_BRIDGE_H_ - - -#include <string> -#include "net/http/http_request_headers.h" -#include "net/http/http_response_headers.h" - -#define EXPORT __attribute__((visibility("default"), used)) - -namespace net -{ - //HttpRequestHeader method delegates - //@argument it - should be initialized to NULL - extern void GetFirstHttpRequestHeader(net::HttpRequestHeaders& req, void*& it) EXPORT; - extern const std::string& GetHttpRequestHeaderName( void*& it ) EXPORT; - extern const std::string& GetHttpRequestHeaderValue( void*& it ) EXPORT; - bool GetHttpRequestHeaderByValue( net::HttpRequestHeaders& req, - const std::string& headerName, - std::string* headerValue) EXPORT; - extern void GetNextHttpRequestHeader( void*& it ) EXPORT; - - extern void SetHttpRequestHeader(net::HttpRequestHeaders& req, const std::string& headerName, - const std::string& value) EXPORT; - extern void RemoveHttpRequestHeader(net::HttpRequestHeaders& req, const std::string& headerName) EXPORT; - - ////HttpResponseHeader method delegates - extern void RemoveHttpResponseHeader(net::HttpResponseHeaders* res, const std::string& headerName) EXPORT; - extern std::string GetHttpResponseHeaderValue(net::HttpResponseHeaders* res, const std::string& headerName) EXPORT; - extern int GetHttpResponseCode(net::HttpResponseHeaders* res) EXPORT; - extern bool HasHttpResponseHeader(net::HttpResponseHeaders* res, const std::string& headerName) EXPORT; - - extern void initBridge(); -}; - - -#endif /* HTTP_GETZIP_BRIDGE_H_ */ diff --git a/net/http/http_getzip_factory.cc b/net/http/http_getzip_factory.cc deleted file mode 100644 index 02948d8..0000000 --- a/net/http/http_getzip_factory.cc +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright (c) 2012, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other *materials provided - * with the distribution. - * * Neither the name of Code Aurora Forum, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - **/ - -#include "net/http/http_getzip_factory.h" -#include "net/socket/client_socket.h" -#include <cutils/log.h> -#include <dlfcn.h> - -namespace net -{ - -HttpGetZipFactory* HttpGetZipFactory::s_pFactory = NULL; - -typedef IGetZipManager* mngr_create_(); - -HttpGetZipFactory::HttpGetZipFactory() : - m_pMngr(NULL), libHandle(NULL) -{ -} - -HttpGetZipFactory::~HttpGetZipFactory() -{ - delete m_pMngr; - m_pMngr = NULL; - - if (NULL != libHandle) - { - ::dlclose(libHandle); - libHandle = NULL; - } -} - -void HttpGetZipFactory::InitGETZipManager() -{ - if (NULL != s_pFactory) - return; - - s_pFactory = new HttpGetZipFactory(); - - s_pFactory->libHandle = ::dlopen("libgetzip.so", RTLD_NOW); - - if (s_pFactory->libHandle) - { - SLOGD("%s: libgetzip.so successfully loaded", __FILE__); - dlerror(); - mngr_create_* mngrCreate = (mngr_create_*) dlsym(s_pFactory->libHandle, - "createGETZipManager"); - - if (mngrCreate) - { - SLOGD("%s,: GETzip initializing method was found in libgetzip.so", - __FILE__); - s_pFactory->m_pMngr = (IGetZipManager*) mngrCreate(); - if( NULL == s_pFactory->m_pMngr) - { - s_pFactory->m_pMngr = new GetZipManager(); - } - return; - } - SLOGD("netstack: Failed to find createGETZipManager sybmol in libgetzip.so"); - ::dlclose(s_pFactory->libHandle); - s_pFactory->libHandle = NULL; - s_pFactory->m_pMngr = new GetZipManager(); - return; - } - - SLOGD("%s: Failed to construct GETzip manager, didn't find the library!", - __FILE__); - s_pFactory->m_pMngr = new GetZipManager(); -} - -IGetZipManager* HttpGetZipFactory::GetGETZipManager() -{ - return s_pFactory->m_pMngr; -} - -void HttpGetZipFactory::StopGETZipManager() -{ - if (libHandle == NULL) - return; - - delete m_pMngr; - m_pMngr = new GetZipManager(); - ::dlclose(libHandle); - libHandle = NULL; -} - -IGetZipManager::IGetZipManager() -{ -} - -IGetZipManager::~IGetZipManager() -{ -} - -GetZipManager::GetZipManager() -{ -} - -} -; //end network diff --git a/net/http/http_getzip_factory.h b/net/http/http_getzip_factory.h deleted file mode 100644 index f7cced0..0000000 --- a/net/http/http_getzip_factory.h +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Copyright (c) 2012, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other *materials provided - * with the distribution. - * * Neither the name of Code Aurora Forum, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - **/ - -#ifndef HTTP_GETZIP_FACTORY_H_ -#define HTTP_GETZIP_FACTORY_H_ - -#include "net/socket/client_socket.h" -#include <sys/types.h> -#include "base/basictypes.h" - -namespace net -{ - -//forward declarations -class HttpRequestHeaders; -class HttpResponseHeaders; - -typedef enum -{ - GETZIP_OK = 1, - REQUEST_RETRY_NEEDED = 2, //GETzip failure that requires last request retry - NULL_ARGUMENT = 3, //One of the passed argument was NULL - NO_GETZIP_CONNECTION = 4 //No GETzip connection was found -} GETZipDecompressionStatus; - -//Main GetZip interface -class IGetZipManager -{ -public: - IGetZipManager(); - virtual void CompressRequestHeaders(HttpRequestHeaders&, ClientSocket*) = 0; - virtual GETZipDecompressionStatus - DecompressResponseHeaders(HttpResponseHeaders*, ClientSocket*) = 0; - virtual void StopGetZipConnection(ClientSocket*) = 0; - virtual void OpenGetZipConnection(ClientSocket*) = 0; - virtual ~IGetZipManager() = 0; - -private: - DISALLOW_COPY_AND_ASSIGN(IGetZipManager); -}; - -//Simple, non private GetZip manager implementation -class GetZipManager: public IGetZipManager -{ -public: - - GetZipManager(); - virtual ~GetZipManager() - { - } - ; - - virtual void CompressRequestHeaders(HttpRequestHeaders&, ClientSocket*) - { - } - ; - virtual GETZipDecompressionStatus DecompressResponseHeaders(HttpResponseHeaders*, ClientSocket*) - { - return NO_GETZIP_CONNECTION; - } - ; - virtual void StopGetZipConnection(ClientSocket*) - { - } - ; - virtual void OpenGetZipConnection(ClientSocket*) - { - } - ; - -private: - DISALLOW_COPY_AND_ASSIGN(GetZipManager); -}; - -//This class is used to initialize GetZip manager -//First tries to initialize GetZipManager from proprietary library, -//if the library does not exist, creates GetZipManager -//Note: In the current implementation of network stack all the actions -//related to GetZipManager and GetZipFactory are carried out via IOThread -//hence, the implementation is not synchronized (this might change in the future). -class HttpGetZipFactory -{ - -public: - - //GetZipManager is kept within HttpGetZipFactory, - //which is singleton. - //This method is used to access the GetZipManager - //Don't use it before initializing HttpGetZipFactory object. - static IGetZipManager* GetGETZipManager(); - - //Initialization must be called before accessing - //GetZipManager for the first time. - static void InitGETZipManager(); - - void StopGETZipManager(); - -private: - IGetZipManager* m_pMngr; - static HttpGetZipFactory* s_pFactory; - - void* libHandle; - - HttpGetZipFactory(); - ~HttpGetZipFactory(); - - DISALLOW_COPY_AND_ASSIGN(HttpGetZipFactory); -}; - -}; //end network -#endif /* HTTP_GETZIP_FACTORY_H_ */ diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc index 5e212b2..8253eac 100644 --- a/net/http/http_network_layer.cc +++ b/net/http/http_network_layer.cc @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +10,6 @@ #include "base/string_util.h" #include "net/http/http_network_session.h" #include "net/http/http_network_transaction.h" -#include "net/http/http_getzip_factory.h" #include "net/spdy/spdy_framer.h" #include "net/spdy/spdy_session.h" #include "net/spdy/spdy_session_pool.h" @@ -23,7 +21,6 @@ HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session) : session_(session), suspended_(false) { DCHECK(session_.get()); - HttpGetZipFactory::InitGETZipManager(); } HttpNetworkLayer::~HttpNetworkLayer() { diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index d36f22a..d13ec97 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, 2012 Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -40,8 +39,7 @@ HttpNetworkSession::HttpNetworkSession(const Params& params) params.dns_cert_checker, params.ssl_host_info_factory, params.proxy_service, - params.ssl_config_service, - this), + params.ssl_config_service), spdy_session_pool_(params.host_resolver, params.ssl_config_service), ALLOW_THIS_IN_INITIALIZER_LIST(http_stream_factory_( new HttpStreamFactoryImpl(this))) { diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 7ef80f7..7f0ac4f 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, 2012 Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -55,7 +54,6 @@ #include "net/spdy/spdy_http_stream.h" #include "net/spdy/spdy_session.h" #include "net/spdy/spdy_session_pool.h" -#include <cutils/log.h> using base::Time; @@ -247,17 +245,8 @@ int HttpNetworkTransaction::RestartWithAuth( void HttpNetworkTransaction::PrepareForAuthRestart(HttpAuth::Target target) { DCHECK(HaveAuth(target)); - PrepareForRetry(true); -} - -void HttpNetworkTransaction::PrepareForGetZipRetry() -{ - PrepareForRetry(false); -} - -void HttpNetworkTransaction::PrepareForRetry(bool isForAuthentication) -{ DCHECK(!stream_request_.get()); + bool keep_alive = false; // Even if the server says the connection is keep-alive, we have to be // able to find the end of each response in order to reuse the connection. @@ -265,10 +254,8 @@ void HttpNetworkTransaction::PrepareForRetry(bool isForAuthentication) stream_->CanFindEndOfResponse()) { // If the response body hasn't been completely read, we need to drain // it first. - // goes to drain body first!!! if (!stream_->IsResponseBodyComplete()) { - next_state_ = isForAuthentication ? STATE_DRAIN_BODY_FOR_AUTH_RESTART: - STATE_DRAIN_BODY_FOR_GETZIP_RETRY; + next_state_ = STATE_DRAIN_BODY_FOR_AUTH_RESTART; read_buf_ = new IOBuffer(kDrainBodyBufferSize); // A bit bucket. read_buf_len_ = kDrainBodyBufferSize; return; @@ -278,58 +265,35 @@ void HttpNetworkTransaction::PrepareForRetry(bool isForAuthentication) // We don't need to drain the response body, so we act as if we had drained // the response body. - isForAuthentication ? - DidDrainBodyForAuthRestart(keep_alive): - DidDrainBodyForGetZipRetry(keep_alive); + DidDrainBodyForAuthRestart(keep_alive); } -void HttpNetworkTransaction::DidDrainBodyForAuthRestart( bool keep_alive ) - { - - DidDrainBodyForRetry( keep_alive ); - // Reset the other member variables. - ResetStateForAuthRestart(); - } - -void HttpNetworkTransaction::DidDrainBodyForGetZipRetry( bool keep_alive ) -{ - DidDrainBodyForRetry( keep_alive ); - read_buf_ = NULL; - read_buf_len_ = 0; - headers_valid_ = false; - request_headers_.Clear(); - response_ = HttpResponseInfo(); -} - -void HttpNetworkTransaction::DidDrainBodyForRetry( bool keep_alive ) -{ - DCHECK( !stream_request_.get() ); +void HttpNetworkTransaction::DidDrainBodyForAuthRestart(bool keep_alive) { + DCHECK(!stream_request_.get()); - if ( stream_.get() ) - { + if (stream_.get()) { HttpStream* new_stream = NULL; - if ( keep_alive && stream_->IsConnectionReusable() ) - { + if (keep_alive && stream_->IsConnectionReusable()) { // We should call connection_->set_idle_time(), but this doesn't occur // often enough to be worth the trouble. stream_->SetConnectionReused(); new_stream = stream_->RenewStreamForAuth(); } - if ( !new_stream ) - { + if (!new_stream) { // Close the stream and mark it as not_reusable. Even in the // keep_alive case, we've determined that the stream_ is not // reusable if new_stream is NULL. - stream_->Close( true ); + stream_->Close(true); next_state_ = STATE_CREATE_STREAM; - } - else - { + } else { next_state_ = STATE_INIT_STREAM; } - stream_.reset( new_stream ); + stream_.reset(new_stream); } + + // Reset the other member variables. + ResetStateForAuthRestart(); } bool HttpNetworkTransaction::IsReadyToRestartForAuth() { @@ -595,13 +559,6 @@ int HttpNetworkTransaction::DoLoop(int result) { net_log_.EndEventWithNetErrorCode( NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, rv); break; - case STATE_DRAIN_BODY_FOR_GETZIP_RETRY: - DCHECK_EQ(OK, rv); - rv = DoDrainBodyForGetZipRetry(); - break; - case STATE_DRAIN_BODY_FOR_GETZIP_RETRY_COMPLETE: - rv = DoDrainBodyForGetZipRetryComplete(rv); - break; case STATE_DRAIN_BODY_FOR_AUTH_RESTART: DCHECK_EQ(OK, rv); net_log_.BeginEvent( @@ -1006,28 +963,9 @@ int HttpNetworkTransaction::DoDrainBodyForAuthRestart() { return rv; } -int HttpNetworkTransaction::DoDrainBodyForGetZipRetry() { - int rv = DoReadBody(); - DCHECK(next_state_ == STATE_READ_BODY_COMPLETE); - next_state_ = STATE_DRAIN_BODY_FOR_GETZIP_RETRY_COMPLETE; - return rv; -} - -int HttpNetworkTransaction::DoDrainBodyForGetZipRetryComplete(int result) { - DoDrainBodyForRetryComplete( result, false ); - return OK; -} - // TODO(wtc): This method and the DoReadBodyComplete method are almost // the same. Figure out a good way for these two methods to share code. int HttpNetworkTransaction::DoDrainBodyForAuthRestartComplete(int result) { - DoDrainBodyForRetryComplete( result, true ); - return OK; -} - -void HttpNetworkTransaction::DoDrainBodyForRetryComplete( int result, - bool isForAuthentication ) -{ // keep_alive defaults to true because the very reason we're draining the // response body is to reuse the connection for auth restart. bool done = false, keep_alive = true; @@ -1040,15 +978,13 @@ void HttpNetworkTransaction::DoDrainBodyForRetryComplete( int result, } if (done) { - isForAuthentication ? - DidDrainBodyForAuthRestart(keep_alive): - DidDrainBodyForGetZipRetry(keep_alive); + DidDrainBodyForAuthRestart(keep_alive); } else { // Keep draining. - next_state_ = isForAuthentication ? - STATE_DRAIN_BODY_FOR_AUTH_RESTART : - STATE_DRAIN_BODY_FOR_GETZIP_RETRY ; + next_state_ = STATE_DRAIN_BODY_FOR_AUTH_RESTART; } + + return OK; } void HttpNetworkTransaction::LogTransactionConnectedMetrics() { @@ -1254,12 +1190,8 @@ int HttpNetworkTransaction::HandleIOError(int error) { // cause SSL handshake errors to be delayed until the first or second Write // (Snap Start) or the first Read (False & Snap Start) on the underlying // connection. - if(error != ERR_GETZIP) - error = HandleSSLHandshakeError(error); - else - { - SLOGD("%s:%s:: SHUTR protocol failure", __FILE__, __FUNCTION__); - } + error = HandleSSLHandshakeError(error); + switch (error) { // If we try to reuse a connection that the server is in the process of // closing, we may end up successfully writing out our request (or a @@ -1277,10 +1209,6 @@ int HttpNetworkTransaction::HandleIOError(int error) { ResetConnectionAndRequestForResend(); error = OK; break; - case ERR_GETZIP: - PrepareForGetZipRetry(); - error = OK; - break; } return error; } @@ -1410,8 +1338,6 @@ std::string HttpNetworkTransaction::DescribeState(State state) { STATE_CASE(STATE_READ_HEADERS_COMPLETE); STATE_CASE(STATE_READ_BODY); STATE_CASE(STATE_READ_BODY_COMPLETE); - STATE_CASE(STATE_DRAIN_BODY_FOR_GETZIP_RETRY); - STATE_CASE(STATE_DRAIN_BODY_FOR_GETZIP_RETRY_COMPLETE); STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART); STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE); STATE_CASE(STATE_NONE); diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h index 7abfcf9..00e9a65 100644 --- a/net/http/http_network_transaction.h +++ b/net/http/http_network_transaction.h @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -103,8 +102,6 @@ class HttpNetworkTransaction : public HttpTransaction, STATE_READ_HEADERS_COMPLETE, STATE_READ_BODY, STATE_READ_BODY_COMPLETE, - STATE_DRAIN_BODY_FOR_GETZIP_RETRY, - STATE_DRAIN_BODY_FOR_GETZIP_RETRY_COMPLETE, STATE_DRAIN_BODY_FOR_AUTH_RESTART, STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, STATE_NONE @@ -140,9 +137,6 @@ class HttpNetworkTransaction : public HttpTransaction, int DoReadBodyComplete(int result); int DoDrainBodyForAuthRestart(); int DoDrainBodyForAuthRestartComplete(int result); - int DoDrainBodyForGetZipRetry(); - int DoDrainBodyForGetZipRetryComplete(int result); - void DoDrainBodyForRetryComplete( int result, bool isForAuthentication ); void BuildRequestHeaders(bool using_proxy); @@ -188,28 +182,10 @@ class HttpNetworkTransaction : public HttpTransaction, // Sets up the state machine to restart the transaction with auth. void PrepareForAuthRestart(HttpAuth::Target target); - // Sets up the state machine to restart the transaction if - // GETzip error occurred. - void PrepareForGetZipRetry(); - - // Sets up the state machine to restart the transaction. - void PrepareForRetry(bool isForAuthentication); - // Called when we don't need to drain the response body or have drained it. - // Clears request info for transaction restart for auth. - // Uses DidDrainBodyForRetry to reset connection if needed and to - // set next_state_ - void DidDrainBodyForAuthRestart(bool keep_alive); - - // Called when we don't need to drain the response body or have drained it. - // Clears request info for transaction retry caused by GETzip error. - // Uses DidDrainBodyForRetry to reset connection if needed and to - // set next_state_ - void DidDrainBodyForGetZipRetry(bool keep_alive); - // Resets |connection_| unless |keep_alive| is true, then calls // ResetStateForRestart. Sets |next_state_| appropriately. - void DidDrainBodyForRetry( bool keep_alive ); + void DidDrainBodyForAuthRestart(bool keep_alive); // Resets the members of the transaction so it can be restarted. void ResetStateForRestart(); diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc index 94a51e1..c28d0e6 100644 --- a/net/http/http_proxy_client_socket_pool.cc +++ b/net/http/http_proxy_client_socket_pool.cc @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, 2012 Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -426,8 +425,7 @@ HttpProxyClientSocketPool::HttpProxyClientSocketPool( HostResolver* host_resolver, TransportClientSocketPool* transport_pool, SSLClientSocketPool* ssl_pool, - NetLog* net_log, - HttpNetworkSession *network_session) + NetLog* net_log) : transport_pool_(transport_pool), ssl_pool_(ssl_pool), base_(max_sockets, max_sockets_per_group, histograms, @@ -437,8 +435,7 @@ HttpProxyClientSocketPool::HttpProxyClientSocketPool( new HttpProxyConnectJobFactory(transport_pool, ssl_pool, host_resolver, - net_log), - network_session) {} + net_log)) {} HttpProxyClientSocketPool::~HttpProxyClientSocketPool() {} diff --git a/net/http/http_proxy_client_socket_pool.h b/net/http/http_proxy_client_socket_pool.h index c539ede..2ab331e 100644 --- a/net/http/http_proxy_client_socket_pool.h +++ b/net/http/http_proxy_client_socket_pool.h @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2012 Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,7 +31,6 @@ class SpdySessionPool; class SpdyStream; class TransportClientSocketPool; class TransportSocketParams; -class HttpNetworkSession; // HttpProxySocketParams only needs the socket params for one of the proxy // types. The other param must be NULL. When using an HTTP Proxy, @@ -181,8 +179,7 @@ class HttpProxyClientSocketPool : public ClientSocketPool { HostResolver* host_resolver, TransportClientSocketPool* transport_pool, SSLClientSocketPool* ssl_pool, - NetLog* net_log, - HttpNetworkSession *network_session); + NetLog* net_log); virtual ~HttpProxyClientSocketPool(); diff --git a/net/http/http_request_headers.cc b/net/http/http_request_headers.cc index 9cb3a83..9d523c1 100644 --- a/net/http/http_request_headers.cc +++ b/net/http/http_request_headers.cc @@ -1,5 +1,4 @@ // Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,7 +12,6 @@ namespace net { const char HttpRequestHeaders::kGetMethod[] = "GET"; -const char HttpRequestHeaders::kHeadMethod[] = "HEAD"; const char HttpRequestHeaders::kAcceptCharset[] = "Accept-Charset"; const char HttpRequestHeaders::kAcceptEncoding[] = "Accept-Encoding"; const char HttpRequestHeaders::kAcceptLanguage[] = "Accept-Language"; diff --git a/net/http/http_request_headers.h b/net/http/http_request_headers.h index e130ab1..d574ae4 100644 --- a/net/http/http_request_headers.h +++ b/net/http/http_request_headers.h @@ -1,5 +1,4 @@ // Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -56,7 +55,6 @@ class NET_EXPORT HttpRequestHeaders { }; static const char kGetMethod[]; - static const char kHeadMethod[]; static const char kAcceptCharset[]; static const char kAcceptEncoding[]; diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 5d0d9ed..0649bce 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,15 +18,13 @@ #include "net/http/http_util.h" #include "net/socket/ssl_client_socket.h" #include "net/socket/client_socket_handle.h" -#include "net/http/http_getzip_factory.h" namespace net { HttpStreamParser::HttpStreamParser(ClientSocketHandle* connection, const HttpRequestInfo* request, GrowableIOBuffer* read_buffer, - const BoundNetLog& net_log, - bool using_proxy) + const BoundNetLog& net_log) : io_state_(STATE_NONE), request_(request), request_headers_(NULL), @@ -47,10 +44,7 @@ HttpStreamParser::HttpStreamParser(ClientSocketHandle* connection, io_callback_(this, &HttpStreamParser::OnIOComplete)), chunk_length_(0), chunk_length_without_encoding_(0), - sent_last_chunk_(false), - using_proxy_(using_proxy), - has_to_retry_(false){ - + sent_last_chunk_(false) { DCHECK_EQ(0, read_buffer->offset()); } @@ -68,7 +62,7 @@ int HttpStreamParser::SendRequest(const std::string& request_line, DCHECK(!user_callback_); DCHECK(callback); DCHECK(response); - has_to_retry_ = false; + if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, @@ -84,15 +78,6 @@ int HttpStreamParser::SendRequest(const std::string& request_line, return result; response_->socket_address = HostPortPair::FromAddrInfo(address.head()); - //Shutr only for GET/HEAD requests - if((!(using_proxy_)) && ((request_line.find(HttpRequestHeaders::kGetMethod) == 0) || - (request_line.find(HttpRequestHeaders::kHeadMethod) == 0))) - { - HttpGetZipFactory::GetGETZipManager()->CompressRequestHeaders( - const_cast<HttpRequestHeaders &>(headers), - connection_->socket()); - } - std::string request = request_line + headers.ToString(); scoped_refptr<StringIOBuffer> headers_io_buf(new StringIOBuffer(request)); request_headers_ = new DrainableIOBuffer(headers_io_buf, @@ -176,11 +161,6 @@ void HttpStreamParser::OnIOComplete(int result) { if (result != ERR_IO_PENDING && user_callback_) { CompletionCallback* c = user_callback_; user_callback_ = NULL; - if(has_to_retry_ ) - { - result = ERR_GETZIP; - has_to_retry_ = false; - } c->Run(result); } } @@ -221,19 +201,8 @@ int HttpStreamParser::DoLoop(int result) { break; case STATE_READ_HEADERS_COMPLETE: result = DoReadHeadersComplete(result); - if(!using_proxy_) - { - GETZipDecompressionStatus st = - HttpGetZipFactory::GetGETZipManager()->DecompressResponseHeaders( - response_->headers.get(), - connection_->socket()); - if( st == REQUEST_RETRY_NEEDED ) - { - has_to_retry_ = true; - } - } net_log_.EndEventWithNetErrorCode( - NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS, result); + NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS, result); break; case STATE_BODY_PENDING: DCHECK(result != ERR_IO_PENDING); diff --git a/net/http/http_stream_parser.h b/net/http/http_stream_parser.h index fa3e6fc..2192eff 100644 --- a/net/http/http_stream_parser.h +++ b/net/http/http_stream_parser.h @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -37,9 +36,7 @@ class HttpStreamParser : public ChunkCallback { HttpStreamParser(ClientSocketHandle* connection, const HttpRequestInfo* request, GrowableIOBuffer* read_buffer, - const BoundNetLog& net_log, - bool using_proxy = false); - + const BoundNetLog& net_log); ~HttpStreamParser(); // These functions implement the interface described in HttpStream with @@ -189,10 +186,6 @@ class HttpStreamParser : public ChunkCallback { // The underlying socket. ClientSocketHandle* const connection_; - bool using_proxy_; - - bool has_to_retry_; - BoundNetLog net_log_; // Callback to be used when doing IO. diff --git a/net/http/net-plugin-bridge-exports.h b/net/http/net-plugin-bridge-exports.h deleted file mode 100644 index 773602a..0000000 --- a/net/http/net-plugin-bridge-exports.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2011, Code Aurora Forum. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided -* with the distribution. -* * Neither the name of Code Aurora Forum, Inc. nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// API for the network plug-in -#ifndef NET_HTTP_NET_PLUGIN_BRIDGE_EXPORTS_H_ -#define NET_HTTP_NET_PLUGIN_BRIDGE_EXPORTS_H_ - -// export these functions from libwebcore, may be used by the plug-in -extern bool HeadersIsRedirect(const net::HttpResponseHeaders* h, std::string& s) - __attribute__ ((visibility ("default"), used)); -extern GURL GurlResolveOrigin(const net::HttpRequestInfo* req, std::string& s) - __attribute__ ((visibility ("default"), used)); -extern GURL GurlOrigin(const net::HttpRequestInfo* req) - __attribute__ ((visibility ("default"), used)); -extern void NetPreconnect(net::HttpNetworkSession*, GURL const&) - __attribute__ ((visibility ("default"), used)); - -#endif /* NET_HTTP_NET_PLUGIN_BRIDGE_EXPORTS_H_ */ diff --git a/net/http/net-plugin-bridge.cc b/net/http/net-plugin-bridge.cc deleted file mode 100644 index 42019ca..0000000 --- a/net/http/net-plugin-bridge.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2011, 2012 Code Aurora Forum. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided -* with the distribution. -* * Neither the name of Code Aurora Forum, Inc. nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "net/http/http_cache_transaction.h" - -#include "build/build_config.h" - -#include <unistd.h> - -#include <string> - -#include "base/compiler_specific.h" -#include "net/http/http_response_headers.h" -#include "net/http/preconnect.h" - -#include "net/http/net-plugin-bridge.h" -#include "net/http/net-plugin-bridge-exports.h" -#include <dlfcn.h> -#include <cutils/log.h> - -static void (*DoObserveRevalidation)(const net::HttpResponseInfo* resp, - const net::HttpRequestInfo* req, net::HttpCache* cache) = NULL; - -static void InitOnce() { - static bool initialized = false; - if (!initialized) { - initialized = true; - void* fh = dlopen("qnet-plugin.so", RTLD_LAZY); - if (fh) { - const char *error; - - dlerror(); //see man dlopen - *(void **)(&DoObserveRevalidation) = dlsym(fh, "DoObserveRevalidation"); - if (NULL != (error = dlerror())) { - DoObserveRevalidation = NULL; - } - } - if (NULL == DoObserveRevalidation) { - SLOGD("Failed to load DoObserveRevalidation symbol in qnet-plugin.so"); - } - } -} - -void ObserveRevalidation(const net::HttpResponseInfo* resp, - const net::HttpRequestInfo* req, net::HttpCache* cache) { - InitOnce(); - if (DoObserveRevalidation) { - DoObserveRevalidation(resp, req, cache); - } -} - - -bool HeadersIsRedirect(const net::HttpResponseHeaders* headers, - std::string& location) { - return headers->IsRedirect(&location); -} - -GURL GurlResolveOrigin(const net::HttpRequestInfo* req, - std::string& location) { - return req->url.Resolve(location).GetOrigin(); -} - -GURL GurlOrigin(const net::HttpRequestInfo* req) { - return req->url.GetOrigin(); -} - -void NetPreconnect(net::HttpNetworkSession* session, GURL const& url) { - net::Preconnect::DoPreconnect(session, url); -} diff --git a/net/http/net-plugin-bridge.h b/net/http/net-plugin-bridge.h deleted file mode 100644 index 09f45e9..0000000 --- a/net/http/net-plugin-bridge.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2011, Code Aurora Forum. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided -* with the distribution. -* * Neither the name of Code Aurora Forum, Inc. nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef NET_HTTP_NET_PLUGIN_BRIDGE_H_ -#define NET_HTTP_NET_PLUGIN_BRIDGE_H_ - -// revalidated cache entries observer -extern void ObserveRevalidation(const net::HttpResponseInfo* resp, - const net::HttpRequestInfo* req, net::HttpCache* cache); - -#endif /* NET_HTTP_NET_PLUGIN_BRIDGE_H_ */ diff --git a/net/http/preconnect.cc b/net/http/preconnect.cc deleted file mode 100644 index 929b627..0000000 --- a/net/http/preconnect.cc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/http/preconnect.h" - -#include "base/logging.h" -#include "net/proxy/proxy_info.h" -#include "net/http/http_stream_factory.h" -#include "net/http/http_network_session.h" - -namespace net { - - -// static -void Preconnect::DoPreconnect(HttpNetworkSession* session, - const GURL& url, int count, - HttpRequestInfo::RequestMotivation motivation ) { - Preconnect* preconnect = new Preconnect(session); - preconnect->Connect(url, count, motivation); -} - -Preconnect::Preconnect(HttpNetworkSession* session) - : session_(session), - ALLOW_THIS_IN_INITIALIZER_LIST( - io_callback_(this, &Preconnect::OnPreconnectComplete)) {} - -Preconnect::~Preconnect() {} - -void Preconnect::Connect(const GURL& url, int count, - HttpRequestInfo::RequestMotivation motivation) { - - request_info_.reset(new HttpRequestInfo()); - request_info_->url = url; - request_info_->method = "GET"; - // It almost doesn't matter whether we use net::LOWEST or net::HIGHEST - // priority here, as we won't make a request, and will surrender the created - // socket to the pool as soon as we can. However, we would like to mark the - // speculative socket as such, and IF we use a net::LOWEST priority, and if - // a navigation asked for a socket (after us) then it would get our socket, - // and we'd get its later-arriving socket, which might make us record that - // the speculation didn't help :-/. By using net::HIGHEST, we ensure that - // a socket is given to us if "we asked first" and this allows us to mark it - // as speculative, and better detect stats (if it gets used). - // TODO(jar): histogram to see how often we accidentally use a previously- - // unused socket, when a previously used socket was available. - request_info_->priority = HIGHEST; - request_info_->motivation = motivation; - - // Setup the SSL Configuration. - ssl_config_.reset(new SSLConfig()); - session_->ssl_config_service()->GetSSLConfig(ssl_config_.get()); - if (session_->http_stream_factory()->next_protos()) - ssl_config_->next_protos = *session_->http_stream_factory()->next_protos(); - - // All preconnects should perform EV certificate verification. - ssl_config_->verify_ev_cert = true; - - proxy_info_.reset(new ProxyInfo()); - HttpStreamFactory* stream_factory = session_->http_stream_factory(); - stream_factory->PreconnectStreams(count, *(request_info_.get()), - *(ssl_config_.get()), net_log_); -} - -void Preconnect::OnPreconnectComplete(int error_code) { - delete this; -} - -} // namespace net diff --git a/net/http/preconnect.h b/net/http/preconnect.h deleted file mode 100644 index e7e1914..0000000 --- a/net/http/preconnect.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// A Preconnect instance maintains state while a TCP/IP connection is made, and -// and then released into the pool of available connections for future use. - -#ifndef NET_HTTP_PRECONNECT_H__ -#define NET_HTTP_PRECONNECT_H__ -#pragma once - -#include "base/scoped_ptr.h" -#include "net/base/completion_callback.h" -#include "net/base/net_log.h" -#include "net/http/http_request_info.h" -#include "net/http/http_stream_factory.h" - -namespace net { - -class ProxyInfo; -struct SSLConfig; - -class Preconnect { - public: - // Try to preconnect. Typically used by predictor when a subresource probably - // needs a connection. |count| may be used to request more than one connection - // be established in parallel. - static void DoPreconnect(HttpNetworkSession* session, const GURL& url, - int count = 1, HttpRequestInfo::RequestMotivation motivation = - HttpRequestInfo::PRECONNECT_MOTIVATED); - - private: - explicit Preconnect(HttpNetworkSession* session); - virtual ~Preconnect(); - - void OnPreconnectComplete(int error_code); - - // Request actual connection, via interface that tags request as needed for - // preconnect only (so that they can be merged with connections needed for - // navigations). - void Connect(const GURL& url, int count, - HttpRequestInfo::RequestMotivation motivation); - - HttpNetworkSession * session_; - // HttpRequestInfo used for connecting. - scoped_ptr<HttpRequestInfo> request_info_; - - // SSLConfig used for connecting. - scoped_ptr<SSLConfig> ssl_config_; - - // ProxyInfo used for connecting. - scoped_ptr<ProxyInfo> proxy_info_; - - // A net log to use for this preconnect. - BoundNetLog net_log_; - - // Our preconnect. - scoped_ptr<HttpStreamRequest> stream_request_; - - CompletionCallbackImpl<Preconnect> io_callback_; - - DISALLOW_COPY_AND_ASSIGN(Preconnect); -}; -} // namespace net -#endif // NET_HTTP_HTTP_REQUEST_INFO_H__ - diff --git a/net/http/tcp-connections-bridge-exports.h b/net/http/tcp-connections-bridge-exports.h deleted file mode 100644 index 3d873cd..0000000 --- a/net/http/tcp-connections-bridge-exports.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2011, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Code Aurora Forum, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// API for the network plug-in -#ifndef NET_HTTP_TCP_CONNECTIONS_BRIDGE_EXPORTS_H_ -#define NET_HTTP_TCP_CONNECTIONS_BRIDGE_EXPORTS_H_ - -// export these functions from libwebcore, may be used by the plug-in -extern void NetPreconnect(net::HttpNetworkSession*, GURL const&, int numOfConnections) - __attribute__ ((visibility ("default"), used)); - -#endif /* NET_HTTP_NET_PLUGIN_BRIDGE_EXPORTS_H_ */ diff --git a/net/http/tcp-connections-bridge.cc b/net/http/tcp-connections-bridge.cc deleted file mode 100644 index 3201b3d..0000000 --- a/net/http/tcp-connections-bridge.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2011, 2012 Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Code Aurora Forum, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "build/build_config.h" - -#include <unistd.h> - -#include <string> - -#include "base/compiler_specific.h" -#include "net/http/http_response_headers.h" -#include "net/http/preconnect.h" - -#include "net/http/tcp-connections-bridge.h" -#include "net/http/tcp-connections-bridge-exports.h" -#include "net/http/http_network_session.h" -#include <dlfcn.h> -#include <cutils/log.h> - -static void (*DoObserveConnections)( - net::HttpNetworkSession* session, - const GURL& url) = NULL; - -static void InitOnce() { - static bool initialized = false; - if (!initialized) { - initialized = true; - void* fh = dlopen("tcp-connections.so", RTLD_LAZY); - if (fh) { - dlerror(); //see man dlopen - *(void **)(&DoObserveConnections) = dlsym(fh, "DoObserveConnections"); - } - if (NULL == DoObserveConnections) { - SLOGD("Failed to load DoObserveConnections symbol in tcp-connections.so"); - } - } -} - -void ObserveConnections( - net::HttpNetworkSession *session, - const GURL& url -) -{ - InitOnce(); - if (DoObserveConnections) { - DoObserveConnections(session, url); - } -} - -void NetPreconnect(net::HttpNetworkSession* session, GURL const& url, int numOfConnections) { - net::Preconnect::DoPreconnect(session, url, numOfConnections); -} diff --git a/net/http/tcp-connections-bridge.h b/net/http/tcp-connections-bridge.h deleted file mode 100644 index 94f5501..0000000 --- a/net/http/tcp-connections-bridge.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2011, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Code Aurora Forum, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef NET_HTTP_TCP_CONNECTIONS_BRIDGE_H_ -#define NET_HTTP_TCP_CONNECTIONS_BRIDGE_H_ - -// revalidated cache entries observer -extern void ObserveConnections -( - net::HttpNetworkSession *session, - const GURL& url -); - -#endif /* NET_HTTP_NET_PLUGIN_BRIDGE_H_ */ |