diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-04 15:36:11 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-04 15:36:11 +0000 |
commit | 2227c699c409af182b20d64fae135217d9ab6a24 (patch) | |
tree | 02181ac8440b73d460a67ce216ffef7bad85ff2c /net/http | |
parent | 4f5c54c25a07c7ea62af278b8a455b539273b8e1 (diff) | |
download | chromium_src-2227c699c409af182b20d64fae135217d9ab6a24.zip chromium_src-2227c699c409af182b20d64fae135217d9ab6a24.tar.gz chromium_src-2227c699c409af182b20d64fae135217d9ab6a24.tar.bz2 |
Auto-format style pass over files.
This is a refactor (actually reformat) only - no behavior change in place.
BUG=NONE
TEST=net_unittests.exe
Review URL: http://codereview.chromium.org/1800003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
25 files changed, 210 insertions, 199 deletions
diff --git a/net/http/http_auth_cache.cc b/net/http/http_auth_cache.cc index 3076a89..a7e2309 100644 --- a/net/http/http_auth_cache.cc +++ b/net/http/http_auth_cache.cc @@ -35,8 +35,8 @@ void CheckPathIsValid(const std::string& path) { // |container| an ancestor of |path|? bool IsEnclosingPath(const std::string& container, const std::string& path) { DCHECK(container.empty() || *(container.end() - 1) == '/'); - return (container.empty() && path.empty()) || - (!container.empty() && StartsWithASCII(path, container, true)); + return ((container.empty() && path.empty()) || + (!container.empty() && StartsWithASCII(path, container, true))); } // Debug helper to check that |origin| arguments are properly formed. diff --git a/net/http/http_auth_handler_basic_unittest.cc b/net/http/http_auth_handler_basic_unittest.cc index 3536c2c..ee79d15 100644 --- a/net/http/http_auth_handler_basic_unittest.cc +++ b/net/http/http_auth_handler_basic_unittest.cc @@ -33,10 +33,10 @@ TEST(HttpAuthHandlerBasicTest, GenerateAuthToken) { challenge, HttpAuth::AUTH_SERVER, origin, &basic)); std::string credentials; int rv = basic->GenerateAuthToken(tests[i].username, - tests[i].password, - NULL, - NULL, - &credentials); + tests[i].password, + NULL, + NULL, + &credentials); EXPECT_EQ(OK, rv); EXPECT_STREQ(tests[i].expected_credentials, credentials.c_str()); } diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc index 8f52651..f7aea5b 100644 --- a/net/http/http_auth_handler_digest.cc +++ b/net/http/http_auth_handler_digest.cc @@ -172,7 +172,7 @@ std::string HttpAuthHandlerDigest::AssembleCredentials( std::string nc = StringPrintf("%08x", nonce_count); std::string authorization = std::string("Digest username=") + - HttpUtil::Quote(username); + HttpUtil::Quote(username); authorization += ", realm=" + HttpUtil::Quote(realm_); authorization += ", nonce=" + HttpUtil::Quote(nonce_); authorization += ", uri=" + HttpUtil::Quote(path); diff --git a/net/http/http_auth_handler_digest_unittest.cc b/net/http/http_auth_handler_digest_unittest.cc index e75ada4..6af03fe 100644 --- a/net/http/http_auth_handler_digest_unittest.cc +++ b/net/http/http_auth_handler_digest_unittest.cc @@ -63,7 +63,7 @@ TEST(HttpAuthHandlerDigestTest, ParseChallenge) { { // Check that md5-sess is recognized, as is single QOP "Digest nonce=\"xyz\", algorithm=\"md5-sess\", " - "realm=\"Oblivion\", qop=\"auth\"", + "realm=\"Oblivion\", qop=\"auth\"", true, "Oblivion", "xyz", @@ -257,8 +257,11 @@ TEST(HttpAuthHandlerDigestTest, AssembleCredentials) { EXPECT_TRUE(digest->InitFromChallenge(&tok, HttpAuth::AUTH_SERVER, origin)); std::string creds = digest->AssembleCredentials(tests[i].req_method, - tests[i].req_path, tests[i].username, tests[i].password, - tests[i].cnonce, tests[i].nonce_count); + tests[i].req_path, + tests[i].username, + tests[i].password, + tests[i].cnonce, + tests[i].nonce_count); EXPECT_STREQ(tests[i].expected_creds, creds.c_str()); } diff --git a/net/http/http_auth_handler_ntlm_portable.cc b/net/http/http_auth_handler_ntlm_portable.cc index 7c08e14..f65b104 100644 --- a/net/http/http_auth_handler_ntlm_portable.cc +++ b/net/http/http_auth_handler_ntlm_portable.cc @@ -121,13 +121,12 @@ enum { // We send these flags with our type 1 message. enum { - NTLM_TYPE1_FLAGS = - NTLM_NegotiateUnicode | - NTLM_NegotiateOEM | - NTLM_RequestTarget | - NTLM_NegotiateNTLMKey | - NTLM_NegotiateAlwaysSign | - NTLM_NegotiateNTLM2Key + NTLM_TYPE1_FLAGS = (NTLM_NegotiateUnicode | + NTLM_NegotiateOEM | + NTLM_RequestTarget | + NTLM_NegotiateNTLMKey | + NTLM_NegotiateAlwaysSign | + NTLM_NegotiateNTLM2Key) }; static const char NTLM_SIGNATURE[] = "NTLMSSP"; diff --git a/net/http/http_auth_handler_ntlm_win.cc b/net/http/http_auth_handler_ntlm_win.cc index d3d16ae..7488110 100644 --- a/net/http/http_auth_handler_ntlm_win.cc +++ b/net/http/http_auth_handler_ntlm_win.cc @@ -61,10 +61,10 @@ int HttpAuthHandlerNTLM::GenerateDefaultAuthToken( } HttpAuthHandlerNTLM::Factory::Factory() - : max_token_length_(0), - first_creation_(true), - is_unsupported_(false), - sspi_library_(SSPILibrary::GetDefault()) { + : max_token_length_(0), + first_creation_(true), + is_unsupported_(false), + sspi_library_(SSPILibrary::GetDefault()) { } HttpAuthHandlerNTLM::Factory::~Factory() { diff --git a/net/http/http_auth_unittest.cc b/net/http/http_auth_unittest.cc index 2859e07..cc616a0 100644 --- a/net/http/http_auth_unittest.cc +++ b/net/http/http_auth_unittest.cc @@ -196,7 +196,7 @@ TEST(HttpAuthTest, ChallengeTokenizerNoQuotes) { TEST(HttpAuthTest, ChallengeTokenizerMismatchedQuotes) { std::string challenge_str = "Basic realm=\"foobar@baz.com"; HttpAuth::ChallengeTokenizer challenge(challenge_str.begin(), - challenge_str.end()); + challenge_str.end()); EXPECT_TRUE(challenge.valid()); EXPECT_EQ(std::string("Basic"), challenge.scheme()); EXPECT_TRUE(challenge.GetNext()); @@ -212,7 +212,7 @@ TEST(HttpAuthTest, ChallengeTokenizerMismatchedQuotes) { TEST(HttpAuthTest, ChallengeTokenizerMismatchedQuotesNoValue) { std::string challenge_str = "Basic realm=\""; HttpAuth::ChallengeTokenizer challenge(challenge_str.begin(), - challenge_str.end()); + challenge_str.end()); EXPECT_TRUE(challenge.valid()); EXPECT_EQ(std::string("Basic"), challenge.scheme()); EXPECT_TRUE(challenge.GetNext()); @@ -228,7 +228,7 @@ TEST(HttpAuthTest, ChallengeTokenizerMismatchedQuotesNoValue) { TEST(HttpAuthTest, ChallengeTokenizerMismatchedQuotesSpaces) { std::string challenge_str = "Basic realm=\"foo bar"; HttpAuth::ChallengeTokenizer challenge(challenge_str.begin(), - challenge_str.end()); + challenge_str.end()); EXPECT_TRUE(challenge.valid()); EXPECT_EQ(std::string("Basic"), challenge.scheme()); EXPECT_TRUE(challenge.GetNext()); @@ -245,7 +245,7 @@ TEST(HttpAuthTest, ChallengeTokenizerMismatchedQuotesSpaces) { TEST(HttpAuthTest, ChallengeTokenizerMismatchedQuotesMultiple) { std::string challenge_str = "Digest qop=, algorithm=md5, realm=\"foo"; HttpAuth::ChallengeTokenizer challenge(challenge_str.begin(), - challenge_str.end()); + challenge_str.end()); EXPECT_TRUE(challenge.valid()); EXPECT_EQ(std::string("Digest"), challenge.scheme()); EXPECT_TRUE(challenge.GetNext()); diff --git a/net/http/http_byte_range.cc b/net/http/http_byte_range.cc index 8978d9a..60683c5 100644 --- a/net/http/http_byte_range.cc +++ b/net/http/http_byte_range.cc @@ -36,9 +36,9 @@ bool HttpByteRange::HasLastBytePosition() const { bool HttpByteRange::IsValid() const { if (suffix_length_ > 0) return true; - return first_byte_position_ >= 0 && - (last_byte_position_ == kPositionNotSpecified || - last_byte_position_ >= first_byte_position_); + return (first_byte_position_ >= 0 && + (last_byte_position_ == kPositionNotSpecified || + last_byte_position_ >= first_byte_position_)); } bool HttpByteRange::ComputeBounds(int64 size) { @@ -52,9 +52,9 @@ bool HttpByteRange::ComputeBounds(int64 size) { if (!HasFirstBytePosition() && !HasLastBytePosition() && !IsSuffixByteRange()) { - first_byte_position_ = 0; - last_byte_position_ = size - 1; - return true; + first_byte_position_ = 0; + last_byte_position_ = size - 1; + return true; } if (!IsValid()) return false; diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 7c433a9..fc7905b 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -287,7 +287,7 @@ disk_cache::Backend* HttpCache::GetBackend() { disk_cache_.reset(disk_cache::CreateInMemoryCacheBackend(cache_size_)); } else if (!disk_cache_dir_.empty()) { disk_cache_.reset(disk_cache::CreateCacheBackend(disk_cache_dir_, true, - cache_size_, type_)); + cache_size_, type_)); disk_cache_dir_ = FilePath(); // Reclaim memory. } return disk_cache_.get(); @@ -807,7 +807,8 @@ void HttpCache::ProcessPendingQueue(ActiveEntry* entry) { return; entry->will_process_pending_queue = true; - MessageLoop::current()->PostTask(FROM_HERE, + MessageLoop::current()->PostTask( + FROM_HERE, task_factory_.NewRunnableMethod(&HttpCache::OnProcessPendingQueue, entry)); } @@ -908,7 +909,7 @@ void HttpCache::OnIOComplete(int result, NewEntry* new_entry) { } } } else { - if (op == WI_CREATE_ENTRY && result != OK) { + if (op == WI_CREATE_ENTRY && result != OK) { // Failed Create followed by an Open. item->NotifyTransaction(ERR_CACHE_RACE, NULL); fail_requests = true; diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index a25608a..8beb825 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -114,12 +114,12 @@ HttpCache::Transaction::Transaction(HttpCache* cache, bool enable_range_support) io_callback_(this, &Transaction::OnIOComplete)), ALLOW_THIS_IN_INITIALIZER_LIST( cache_callback_(new CancelableCompletionCallback<Transaction>( - this, &Transaction::OnIOComplete))), + this, &Transaction::OnIOComplete))), ALLOW_THIS_IN_INITIALIZER_LIST( write_headers_callback_(new CancelableCompletionCallback<Transaction>( - this, &Transaction::OnIOComplete))) { + this, &Transaction::OnIOComplete))) { COMPILE_ASSERT(HttpCache::Transaction::kNumValidationHeaders == - ARRAYSIZE_UNSAFE(kValidationHeaders), + ARRAYSIZE_UNSAFE(kValidationHeaders), Invalid_number_of_validation_headers); } @@ -902,7 +902,7 @@ int HttpCache::Transaction::DoOverwriteCachedResponse() { response_ = *new_response_; target_state_ = STATE_TRUNCATE_CACHED_DATA; next_state_ = truncated_ ? STATE_CACHE_WRITE_TRUNCATED_RESPONSE : - STATE_CACHE_WRITE_RESPONSE; + STATE_CACHE_WRITE_RESPONSE; return OK; } @@ -1122,7 +1122,7 @@ int HttpCache::Transaction::DoCacheWriteDataComplete(int result) { if (partial_.get()) { // This may be the last request. if (!(result == 0 && !truncated_ && - (partial_->IsLastRange() || mode_ == WRITE))) + (partial_->IsLastRange() || mode_ == WRITE))) return DoPartialNetworkReadCompleted(result); } @@ -1201,7 +1201,7 @@ void HttpCache::Transaction::SetRequest(const BoundNetLog& net_log, const ValidationHeaderInfo& info = kValidationHeaders[i]; std::string validation_value; if (request_->extra_headers.GetHeader( - info.request_header_name, &validation_value)) { + info.request_header_name, &validation_value)) { if (!external_validation_.values[i].empty() || validation_value.empty()) external_validation_error = true; @@ -1452,7 +1452,7 @@ bool HttpCache::Transaction::RequiresValidation() { // 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)) + !response_.vary_data.MatchesRequest(*request_, *response_.headers)) return true; return false; @@ -1682,7 +1682,7 @@ int HttpCache::Transaction::WriteResponseInfoToEntry(bool truncated) { // errors) and no SSL blocking page is shown. An alternative would be to // reverse-map the cert status to a net error and replay the net error. if ((cache_->mode() != RECORD && - response_.headers->HasHeaderValue("cache-control", "no-store")) || + response_.headers->HasHeaderValue("cache-control", "no-store")) || net::IsCertStatusError(response_.ssl_info.cert_status)) { DoneWritingToEntry(false); return OK; diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h index 9ad50e9..9d13b11 100644 --- a/net/http/http_cache_transaction.h +++ b/net/http/http_cache_transaction.h @@ -332,7 +332,7 @@ class HttpCache::Transaction : public HttpTransaction { CompletionCallbackImpl<Transaction> io_callback_; scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; scoped_refptr<CancelableCompletionCallback<Transaction> > - write_headers_callback_; + write_headers_callback_; }; } // namespace net diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index eb1eacf..32b3343 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -300,8 +300,8 @@ class MockDiskEntry : public disk_cache::Entry, void CallbackLater(net::CompletionCallback* callback, int result) { if (ignore_callbacks_) return StoreAndDeliverCallbacks(true, this, callback, result); - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this, - &MockDiskEntry::RunCallback, callback, result)); + MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( + this, &MockDiskEntry::RunCallback, callback, result)); } void RunCallback(net::CompletionCallback* callback, int result) { if (busy_) { @@ -531,7 +531,7 @@ class MockDiskCache : public disk_cache::Backend { } private: - net::CompletionCallback* callback_; + net::CompletionCallback* callback_; int result_; DISALLOW_COPY_AND_ASSIGN(CallbackRunner); }; @@ -751,7 +751,7 @@ void RangeTransactionServer::RangeHandler(const net::HttpRequestInfo* request, std::vector<net::HttpByteRange> ranges; std::string range_header; if (!request->extra_headers.GetHeader( - net::HttpRequestHeaders::kRange, &range_header) || + net::HttpRequestHeaders::kRange, &range_header) || !net::HttpUtil::ParseRangeHeader(range_header, &ranges) || ranges.size() != 1) return; @@ -2145,8 +2145,8 @@ TEST(HttpCache, ConditionalizedRequestUpdatesCache8) { }; const char* kExtraRequestHeaders = - "If-Modified-Since: Wed, 06 Feb 2008 22:38:21 GMT\r\n" - "If-None-Match: \"Foo1\"\r\n"; + "If-Modified-Since: Wed, 06 Feb 2008 22:38:21 GMT\r\n" + "If-None-Match: \"Foo1\"\r\n"; ConditionalizedRequestUpdatesCacheHelper( kNetResponse1, kNetResponse2, kNetResponse2, kExtraRequestHeaders); @@ -2174,8 +2174,8 @@ TEST(HttpCache, ConditionalizedRequestUpdatesCache9) { // The etag doesn't match what we have stored. const char* kExtraRequestHeaders = - "If-Modified-Since: Wed, 06 Feb 2008 22:38:21 GMT\n" - "If-None-Match: \"Foo2\"\n"; + "If-Modified-Since: Wed, 06 Feb 2008 22:38:21 GMT\n" + "If-None-Match: \"Foo2\"\n"; ConditionalizedRequestUpdatesCacheHelper( kNetResponse1, kNetResponse2, kNetResponse1, kExtraRequestHeaders); @@ -2203,8 +2203,8 @@ TEST(HttpCache, ConditionalizedRequestUpdatesCache10) { // The modification date doesn't match what we have stored. const char* kExtraRequestHeaders = - "If-Modified-Since: Fri, 08 Feb 2008 22:38:21 GMT\n" - "If-None-Match: \"Foo1\"\n"; + "If-Modified-Since: Fri, 08 Feb 2008 22:38:21 GMT\n" + "If-None-Match: \"Foo1\"\n"; ConditionalizedRequestUpdatesCacheHelper( kNetResponse1, kNetResponse2, kNetResponse1, kExtraRequestHeaders); @@ -2232,8 +2232,8 @@ TEST(HttpCache, ConditionalizedRequestUpdatesCache11) { // Two dates, the second matches what we have stored. const char* kExtraRequestHeaders = - "If-Modified-Since: Mon, 04 Feb 2008 22:38:21 GMT\n" - "If-Modified-Since: Wed, 06 Feb 2008 22:38:21 GMT\n"; + "If-Modified-Since: Mon, 04 Feb 2008 22:38:21 GMT\n" + "If-Modified-Since: Wed, 06 Feb 2008 22:38:21 GMT\n"; ConditionalizedRequestUpdatesCacheHelper( kNetResponse1, kNetResponse2, kNetResponse1, kExtraRequestHeaders); @@ -3885,12 +3885,12 @@ TEST(HttpCache, SyncRead) { TEST_MODE_SYNC_CACHE_WRITE); MockHttpRequest r1(transaction), - r2(transaction), - r3(transaction); + r2(transaction), + r3(transaction); TestTransactionConsumer c1(cache.http_cache()), - c2(cache.http_cache()), - c3(cache.http_cache()); + c2(cache.http_cache()), + c3(cache.http_cache()); c1.Start(&r1, net::BoundNetLog()); diff --git a/net/http/http_chunked_decoder.cc b/net/http/http_chunked_decoder.cc index 619c9a1..1f6ef0d 100644 --- a/net/http/http_chunked_decoder.cc +++ b/net/http/http_chunked_decoder.cc @@ -116,11 +116,11 @@ int HttpChunkedDecoder::ScanForChunkRemaining(const char* buf, int buf_len) { reached_eof_ = true; } } else if (chunk_terminator_remaining_) { - if (buf_len) { - DLOG(ERROR) << "chunk data not terminated properly"; - return ERR_INVALID_CHUNKED_ENCODING; - } - chunk_terminator_remaining_ = false; + if (buf_len) { + DLOG(ERROR) << "chunk data not terminated properly"; + return ERR_INVALID_CHUNKED_ENCODING; + } + chunk_terminator_remaining_ = false; } else if (buf_len) { // Ignore any chunk-extensions. size_t index_of_semicolon = base::StringPiece(buf, buf_len).find(';'); diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 5242db8..9a65d13 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -61,8 +61,8 @@ void BuildRequestHeaders(const HttpRequestInfo* request_info, std::string* request_line, HttpRequestHeaders* request_headers) { const std::string path = using_proxy ? - HttpUtil::SpecForRequest(request_info->url) : - HttpUtil::PathForRequest(request_info->url); + HttpUtil::SpecForRequest(request_info->url) : + HttpUtil::PathForRequest(request_info->url); *request_line = StringPrintf( "%s %s HTTP/1.1\r\n", request_info->method.c_str(), path.c_str()); request_headers->SetHeader(HttpRequestHeaders::kHost, @@ -118,8 +118,8 @@ void BuildRequestHeaders(const HttpRequestInfo* request_info, HttpRequestHeaders stripped_extra_headers; stripped_extra_headers.CopyFrom(request_info->extra_headers); - for (size_t i = 0; i < arraysize(kExtraHeadersToBeStripped); ++i) - stripped_extra_headers.RemoveHeader(kExtraHeadersToBeStripped[i]); + for (size_t i = 0; i < arraysize(kExtraHeadersToBeStripped); ++i) + stripped_extra_headers.RemoveHeader(kExtraHeadersToBeStripped[i]); request_headers->MergeFrom(stripped_extra_headers); } @@ -185,7 +185,7 @@ void ProcessAlternateProtocol(const HttpResponseHeaders& headers, if (port_protocol_vector[1] != HttpAlternateProtocols::kProtocolStrings[ - HttpAlternateProtocols::NPN_SPDY_1]) { + HttpAlternateProtocols::NPN_SPDY_1]) { // Currently, we only recognize the npn-spdy protocol. DLOG(WARNING) << HttpAlternateProtocols::kHeader << " header has unrecognized protocol: " @@ -757,7 +757,7 @@ int HttpNetworkTransaction::DoInitConnection() { // If the user is refreshing the page, bypass the host cache. bool disable_resolver_cache = request_->load_flags & LOAD_BYPASS_CACHE || - request_->load_flags & LOAD_DISABLE_CACHE; + request_->load_flags & LOAD_DISABLE_CACHE; int rv; if (!proxy_info_.is_direct()) { @@ -913,19 +913,19 @@ int HttpNetworkTransaction::DoSSLConnectComplete(int result) { if (using_spdy_) { UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency", - connect_duration, - base::TimeDelta::FromMilliseconds(1), - base::TimeDelta::FromMinutes(10), - 100); + connect_duration, + base::TimeDelta::FromMilliseconds(1), + base::TimeDelta::FromMinutes(10), + 100); UpdateConnectionTypeHistograms(CONNECTION_SPDY); next_state_ = STATE_SPDY_SEND_REQUEST; } else { UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency", - connect_duration, - base::TimeDelta::FromMilliseconds(1), - base::TimeDelta::FromMinutes(10), - 100); + connect_duration, + base::TimeDelta::FromMilliseconds(1), + base::TimeDelta::FromMinutes(10), + 100); next_state_ = STATE_SEND_REQUEST; } @@ -1109,12 +1109,12 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) { response_ = HttpResponseInfo(); return OK; - // We aren't able to CONNECT to the remote host through the proxy. We - // need to be very suspicious about the response because an active network - // attacker can force us into this state by masquerading as the proxy. - // The only safe thing to do here is to fail the connection because our - // client is expecting an SSL protected response. - // See http://crbug.com/7338. + // We aren't able to CONNECT to the remote host through the proxy. We + // need to be very suspicious about the response because an active + // network attacker can force us into this state by masquerading as the + // proxy. The only safe thing to do here is to fail the connection + // because our client is expecting an SSL protected response. + // See http://crbug.com/7338. case 407: // Proxy Authentication Required // We need this status code to allow proxy authentication. Our // authentication code is smart enough to avoid being tricked by an @@ -1335,7 +1335,7 @@ int HttpNetworkTransaction::DoSpdyReadBodyComplete(int result) { void HttpNetworkTransaction::LogHttpConnectedMetrics( const ClientSocketHandle& handle) { UMA_HISTOGRAM_ENUMERATION("Net.HttpSocketType", handle.reuse_type(), - ClientSocketHandle::NUM_TYPES); + ClientSocketHandle::NUM_TYPES); switch (handle.reuse_type()) { case ClientSocketHandle::UNUSED: @@ -1368,7 +1368,7 @@ void HttpNetworkTransaction::LogHttpConnectedMetrics( void HttpNetworkTransaction::LogIOErrorMetrics( const ClientSocketHandle& handle) { UMA_HISTOGRAM_ENUMERATION("Net.IOError_SocketReuseType", - handle.reuse_type(), ClientSocketHandle::NUM_TYPES); + handle.reuse_type(), ClientSocketHandle::NUM_TYPES); switch (handle.reuse_type()) { case ClientSocketHandle::UNUSED: @@ -1428,7 +1428,7 @@ void HttpNetworkTransaction::LogTransactionConnectedMetrics() const { void HttpNetworkTransaction::LogTransactionMetrics() const { base::TimeDelta duration = base::Time::Now() - - response_.request_time; + response_.request_time; if (60 < duration.InMinutes()) return; @@ -1436,11 +1436,13 @@ void HttpNetworkTransaction::LogTransactionMetrics() const { UMA_HISTOGRAM_LONG_TIMES("Net.Transaction_Latency", duration); UMA_HISTOGRAM_CLIPPED_TIMES("Net.Transaction_Latency_Under_10", duration, - base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), - 100); + base::TimeDelta::FromMilliseconds(1), + base::TimeDelta::FromMinutes(10), + 100); UMA_HISTOGRAM_CLIPPED_TIMES("Net.Transaction_Latency_Total_Under_10", - total_duration, base::TimeDelta::FromMilliseconds(1), - base::TimeDelta::FromMinutes(10), 100); + total_duration, + base::TimeDelta::FromMilliseconds(1), + base::TimeDelta::FromMinutes(10), 100); if (!reused_socket_) { UMA_HISTOGRAM_CLIPPED_TIMES( "Net.Transaction_Latency_Total_New_Connection_Under_10", @@ -1461,7 +1463,7 @@ int HttpNetworkTransaction::HandleCertificateError(int error) { DCHECK(IsCertificateError(error)); SSLClientSocket* ssl_socket = - reinterpret_cast<SSLClientSocket*>(connection_->socket()); + reinterpret_cast<SSLClientSocket*>(connection_->socket()); ssl_socket->GetSSLInfo(&response_.ssl_info); // Add the bad certificate to the set of allowed certificates in the @@ -1523,7 +1525,7 @@ int HttpNetworkTransaction::HandleCertificateRequest(int error) { // If the user selected one of the certificate in client_certs for this // server before, use it automatically. X509Certificate* client_cert = session_->ssl_client_auth_cache()-> - Lookup(GetHostAndPort(request_->url)); + Lookup(GetHostAndPort(request_->url)); if (client_cert) { const std::vector<scoped_refptr<X509Certificate> >& client_certs = response_.cert_request_info->client_certs; @@ -1544,8 +1546,8 @@ int HttpNetworkTransaction::HandleCertificateRequest(int error) { int HttpNetworkTransaction::HandleSSLHandshakeError(int error) { if (ssl_config_.send_client_cert && - (error == ERR_SSL_PROTOCOL_ERROR || - error == ERR_BAD_SSL_CLIENT_AUTH_CERT)) { + (error == ERR_SSL_PROTOCOL_ERROR || + error == ERR_BAD_SSL_CLIENT_AUTH_CERT)) { session_->ssl_client_auth_cache()->Remove(GetHostAndPort(request_->url)); } @@ -1897,7 +1899,7 @@ int HttpNetworkTransaction::HandleAuthChallenge() { if (status != 401 && status != 407) return OK; HttpAuth::Target target = status == 407 ? - HttpAuth::AUTH_PROXY : HttpAuth::AUTH_SERVER; + HttpAuth::AUTH_PROXY : HttpAuth::AUTH_SERVER; GURL auth_origin = AuthOrigin(target); LOG(INFO) << "The " << AuthTargetString(target) << " " diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 465d797..e0b1bfc 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -269,9 +269,10 @@ class CaptureGroupNameSocketPool : public EmulatedClientSocketPool { }; typedef CaptureGroupNameSocketPool<TCPClientSocketPool> - CaptureGroupNameTCPSocketPool; +CaptureGroupNameTCPSocketPool; typedef CaptureGroupNameSocketPool<SOCKSClientSocketPool> - CaptureGroupNameSOCKSSocketPool; +CaptureGroupNameSOCKSSocketPool; + //----------------------------------------------------------------------------- TEST_F(HttpNetworkTransactionTest, Basic) { @@ -1730,7 +1731,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { // Enter the correct password and authenticate successfully. TEST_F(HttpNetworkTransactionTest, NTLMAuth1) { HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom1, - MockGetHostName); + MockGetHostName); SessionDependencies session_deps; scoped_ptr<HttpTransaction> trans( new HttpNetworkTransaction(CreateSession(&session_deps))); @@ -1853,7 +1854,7 @@ TEST_F(HttpNetworkTransactionTest, NTLMAuth1) { // Enter a wrong password, and then the correct one. TEST_F(HttpNetworkTransactionTest, NTLMAuth2) { HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom2, - MockGetHostName); + MockGetHostName); SessionDependencies session_deps; scoped_ptr<HttpTransaction> trans( new HttpNetworkTransaction(CreateSession(&session_deps))); @@ -4796,7 +4797,7 @@ TEST_F(HttpNetworkTransactionTest, MarkBrokenAlternateProtocol) { TEST_F(HttpNetworkTransactionTest, FailNpnSpdyAndFallback) { HttpNetworkTransaction::SetUseAlternateProtocols(true); HttpNetworkTransaction::SetNextProtos( - "\x08http/1.1\x07http1.1\x06spdy/1\x04spdy"); + "\x08http/1.1\x07http1.1\x06spdy/1\x04spdy"); SessionDependencies session_deps; HttpRequestInfo request; @@ -4853,7 +4854,7 @@ TEST_F(HttpNetworkTransactionTest, FailNpnSpdyAndFallback) { TEST_F(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdy) { HttpNetworkTransaction::SetUseAlternateProtocols(true); HttpNetworkTransaction::SetNextProtos( - "\x08http/1.1\x07http1.1\x06spdy/1\x04spdy"); + "\x08http/1.1\x07http1.1\x06spdy/1\x04spdy"); SessionDependencies session_deps; HttpRequestInfo request; @@ -4977,7 +4978,7 @@ TEST_F(HttpNetworkTransactionTest, UseAlternateProtocolForTunneledNpnSpdy) { ProxyConfig proxy_config; proxy_config.proxy_rules().ParseFromString("myproxy:80"); - + CapturingProxyResolver* capturing_proxy_resolver = new CapturingProxyResolver(); SessionDependencies session_deps( @@ -5075,7 +5076,7 @@ TEST_F(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdyWithExistingSpdySession) { HttpNetworkTransaction::SetUseAlternateProtocols(true); HttpNetworkTransaction::SetNextProtos( - "\x08http/1.1\x07http1.1\x06spdy/1\x04spdy"); + "\x08http/1.1\x07http1.1\x06spdy/1\x04spdy"); SessionDependencies session_deps; HttpRequestInfo request; @@ -5311,7 +5312,8 @@ TEST_F(HttpNetworkTransactionTest, ResolveCanonicalName) { // Set up expectations for this pass of the test. Many of the EXPECT calls // are contained inside the MockAuthHandlerCanonical codebase in response to // the expectations. - MockAuthHandlerCanonical::Resolve resolve = (i == 0) ? + MockAuthHandlerCanonical::Resolve resolve = + (i == 0) ? MockAuthHandlerCanonical::RESOLVE_SYNC : MockAuthHandlerCanonical::RESOLVE_ASYNC; auth_handler->SetResolveExpectation(resolve); @@ -5400,7 +5402,7 @@ TEST_F(HttpNetworkTransactionTest, RestartAfterTLSDecompressionFailure) { false /* fail all reads */); TLSDecompressionFailureSocketDataProvider socket_data_provider2(false); SSLSocketDataProvider ssl_socket_data_provider1( - false, ERR_SSL_DECOMPRESSION_FAILURE_ALERT); + false, ERR_SSL_DECOMPRESSION_FAILURE_ALERT); SSLSocketDataProvider ssl_socket_data_provider2(false, OK); session_deps.socket_factory.AddSocketDataProvider(&socket_data_provider1); session_deps.socket_factory.AddSocketDataProvider(&socket_data_provider2); diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index ec3ec3b..2e8d9fb 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -274,8 +274,9 @@ void HttpResponseHeaders::Parse(const std::string& raw_input) { find(line_begin, raw_input.end(), '\0'); // has_headers = true, if there is any data following the status line. // Used by ParseStatusLine() to decide if a HTTP/0.9 is really a HTTP/1.0. - bool has_headers = line_end != raw_input.end() && - (line_end + 1) != raw_input.end() && *(line_end + 1) != '\0'; + bool has_headers = (line_end != raw_input.end() && + (line_end + 1) != raw_input.end() && + *(line_end + 1) != '\0'); ParseStatusLine(line_begin, line_end, has_headers); if (line_end == raw_input.end()) { @@ -1119,9 +1120,9 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position, // Obtain last-byte-pos. std::string::const_iterator last_byte_pos_begin = - byte_range_resp_spec.begin() + minus_position + 1; + byte_range_resp_spec.begin() + minus_position + 1; std::string::const_iterator last_byte_pos_end = - byte_range_resp_spec.end(); + byte_range_resp_spec.end(); HttpUtil::TrimLWS(&last_byte_pos_begin, &last_byte_pos_end); ok &= StringToInt64( @@ -1150,8 +1151,8 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position, if (LowerCaseEqualsASCII(instance_length_begin, instance_length_end, "*")) { return false; } else if (!StringToInt64( - std::string(instance_length_begin, instance_length_end), - instance_length)) { + std::string(instance_length_begin, instance_length_end), + instance_length)) { *instance_length = -1; return false; } diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc index bea4f36..18cd1c4 100644 --- a/net/http/http_response_headers_unittest.cc +++ b/net/http/http_response_headers_unittest.cc @@ -277,9 +277,9 @@ TEST(HttpResponseHeadersTest, RepeatedSetCookie) { TEST(HttpResponseHeadersTest, GetNormalizedHeader) { std::string headers = - "HTTP/1.1 200 OK\n" - "Cache-control: private\n" - "cache-Control: no-store\n"; + "HTTP/1.1 200 OK\n" + "Cache-control: private\n" + "cache-Control: no-store\n"; HeadersToRaw(&headers); scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); @@ -468,9 +468,9 @@ TEST(HttpResponseHeadersTest, EnumerateHeader_Coalesced) { // Ensure that commas in quoted strings are not regarded as value separators. // Ensure that whitespace following a value is trimmed properly std::string headers = - "HTTP/1.1 200 OK\n" - "Cache-control:private , no-cache=\"set-cookie,server\" \n" - "cache-Control: no-store\n"; + "HTTP/1.1 200 OK\n" + "Cache-control:private , no-cache=\"set-cookie,server\" \n" + "cache-Control: no-store\n"; HeadersToRaw(&headers); scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); @@ -489,9 +489,9 @@ TEST(HttpResponseHeadersTest, EnumerateHeader_Challenge) { // Even though WWW-Authenticate has commas, it should not be treated as // coalesced values. std::string headers = - "HTTP/1.1 401 OK\n" - "WWW-Authenticate:Digest realm=foobar, nonce=x, domain=y\n" - "WWW-Authenticate:Basic realm=quatar\n"; + "HTTP/1.1 401 OK\n" + "WWW-Authenticate:Digest realm=foobar, nonce=x, domain=y\n" + "WWW-Authenticate:Basic realm=quatar\n"; HeadersToRaw(&headers); scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); @@ -508,9 +508,9 @@ TEST(HttpResponseHeadersTest, EnumerateHeader_DateValued) { // The comma in a date valued header should not be treated as a // field-value separator std::string headers = - "HTTP/1.1 200 OK\n" - "Date: Tue, 07 Aug 2007 23:10:55 GMT\n" - "Last-Modified: Wed, 01 Aug 2007 23:23:45 GMT\n"; + "HTTP/1.1 200 OK\n" + "Date: Tue, 07 Aug 2007 23:10:55 GMT\n" + "Last-Modified: Wed, 01 Aug 2007 23:23:45 GMT\n"; HeadersToRaw(&headers); scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); @@ -524,130 +524,130 @@ TEST(HttpResponseHeadersTest, EnumerateHeader_DateValued) { TEST(HttpResponseHeadersTest, GetMimeType) { const ContentTypeTestData tests[] = { { "HTTP/1.1 200 OK\n" - "Content-type: text/html\n", + "Content-type: text/html\n", "text/html", true, "", false, "text/html" }, // Multiple content-type headers should give us the last one. { "HTTP/1.1 200 OK\n" - "Content-type: text/html\n" - "Content-type: text/html\n", + "Content-type: text/html\n" + "Content-type: text/html\n", "text/html", true, "", false, "text/html, text/html" }, { "HTTP/1.1 200 OK\n" - "Content-type: text/plain\n" - "Content-type: text/html\n" - "Content-type: text/plain\n" - "Content-type: text/html\n", + "Content-type: text/plain\n" + "Content-type: text/html\n" + "Content-type: text/plain\n" + "Content-type: text/html\n", "text/html", true, "", false, "text/plain, text/html, text/plain, text/html" }, // Test charset parsing. { "HTTP/1.1 200 OK\n" - "Content-type: text/html\n" - "Content-type: text/html; charset=ISO-8859-1\n", + "Content-type: text/html\n" + "Content-type: text/html; charset=ISO-8859-1\n", "text/html", true, "iso-8859-1", true, "text/html, text/html; charset=ISO-8859-1" }, // Test charset in double quotes. { "HTTP/1.1 200 OK\n" - "Content-type: text/html\n" - "Content-type: text/html; charset=\"ISO-8859-1\"\n", + "Content-type: text/html\n" + "Content-type: text/html; charset=\"ISO-8859-1\"\n", "text/html", true, "iso-8859-1", true, "text/html, text/html; charset=\"ISO-8859-1\"" }, // If there are multiple matching content-type headers, we carry // over the charset value. { "HTTP/1.1 200 OK\n" - "Content-type: text/html;charset=utf-8\n" - "Content-type: text/html\n", + "Content-type: text/html;charset=utf-8\n" + "Content-type: text/html\n", "text/html", true, "utf-8", true, "text/html;charset=utf-8, text/html" }, // Test single quotes. { "HTTP/1.1 200 OK\n" - "Content-type: text/html;charset='utf-8'\n" - "Content-type: text/html\n", + "Content-type: text/html;charset='utf-8'\n" + "Content-type: text/html\n", "text/html", true, "utf-8", true, "text/html;charset='utf-8', text/html" }, // Last charset wins if matching content-type. { "HTTP/1.1 200 OK\n" - "Content-type: text/html;charset=utf-8\n" - "Content-type: text/html;charset=iso-8859-1\n", + "Content-type: text/html;charset=utf-8\n" + "Content-type: text/html;charset=iso-8859-1\n", "text/html", true, "iso-8859-1", true, "text/html;charset=utf-8, text/html;charset=iso-8859-1" }, // Charset is ignored if the content types change. { "HTTP/1.1 200 OK\n" - "Content-type: text/plain;charset=utf-8\n" - "Content-type: text/html\n", + "Content-type: text/plain;charset=utf-8\n" + "Content-type: text/html\n", "text/html", true, "", false, "text/plain;charset=utf-8, text/html" }, // Empty content-type { "HTTP/1.1 200 OK\n" - "Content-type: \n", + "Content-type: \n", "", false, "", false, "" }, // Emtpy charset { "HTTP/1.1 200 OK\n" - "Content-type: text/html;charset=\n", + "Content-type: text/html;charset=\n", "text/html", true, "", false, "text/html;charset=" }, // Multiple charsets, last one wins. { "HTTP/1.1 200 OK\n" - "Content-type: text/html;charset=utf-8; charset=iso-8859-1\n", + "Content-type: text/html;charset=utf-8; charset=iso-8859-1\n", "text/html", true, "iso-8859-1", true, "text/html;charset=utf-8; charset=iso-8859-1" }, // Multiple params. { "HTTP/1.1 200 OK\n" - "Content-type: text/html; foo=utf-8; charset=iso-8859-1\n", + "Content-type: text/html; foo=utf-8; charset=iso-8859-1\n", "text/html", true, "iso-8859-1", true, "text/html; foo=utf-8; charset=iso-8859-1" }, { "HTTP/1.1 200 OK\n" - "Content-type: text/html ; charset=utf-8 ; bar=iso-8859-1\n", + "Content-type: text/html ; charset=utf-8 ; bar=iso-8859-1\n", "text/html", true, "utf-8", true, "text/html ; charset=utf-8 ; bar=iso-8859-1" }, // Comma embeded in quotes. { "HTTP/1.1 200 OK\n" - "Content-type: text/html ; charset='utf-8,text/plain' ;\n", + "Content-type: text/html ; charset='utf-8,text/plain' ;\n", "text/html", true, "utf-8,text/plain", true, "text/html ; charset='utf-8,text/plain' ;" }, // Charset with leading spaces. { "HTTP/1.1 200 OK\n" - "Content-type: text/html ; charset= 'utf-8' ;\n", + "Content-type: text/html ; charset= 'utf-8' ;\n", "text/html", true, "utf-8", true, "text/html ; charset= 'utf-8' ;" }, // Media type comments in mime-type. { "HTTP/1.1 200 OK\n" - "Content-type: text/html (html)\n", + "Content-type: text/html (html)\n", "text/html", true, "", false, "text/html (html)" }, // Incomplete charset= param { "HTTP/1.1 200 OK\n" - "Content-type: text/html; char=\n", + "Content-type: text/html; char=\n", "text/html", true, "", false, "text/html; char=" }, // Invalid media type: no slash { "HTTP/1.1 200 OK\n" - "Content-type: texthtml\n", + "Content-type: texthtml\n", "", false, "", false, "texthtml" }, // Invalid media type: */* { "HTTP/1.1 200 OK\n" - "Content-type: */*\n", + "Content-type: */*\n", "", false, "", false, "*/*" }, @@ -1477,7 +1477,7 @@ TEST(HttpResponseHeadersTest, HasStrongValidators) { new HttpResponseHeaders(headers); EXPECT_EQ(tests[i].expected_result, parsed->HasStrongValidators()) << - "Failed test case " << i; + "Failed test case " << i; } } diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index e0b18a9..a7c22a3 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -91,7 +91,7 @@ int HttpStreamParser::ReadResponseHeaders(CompletionCallback* callback) { } int HttpStreamParser::ReadResponseBody(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + CompletionCallback* callback) { DCHECK(io_state_ == STATE_BODY_PENDING || io_state_ == STATE_DONE); DCHECK(!user_callback_); DCHECK(callback); @@ -204,9 +204,9 @@ int HttpStreamParser::DoSendHeaders(int result) { if (request_body_ != NULL) { const size_t kBytesPerPacket = 1430; uint64 body_packets = (request_body_->size() + kBytesPerPacket - 1) / - kBytesPerPacket; + kBytesPerPacket; uint64 header_packets = (bytes_remaining + kBytesPerPacket - 1) / - kBytesPerPacket; + kBytesPerPacket; uint64 coalesced_packets = (request_body_->size() + bytes_remaining + kBytesPerPacket - 1) / kBytesPerPacket; if (coalesced_packets < header_packets + body_packets) { diff --git a/net/http/http_transaction_unittest.cc b/net/http/http_transaction_unittest.cc index 01e6ea5..4d9daa5 100644 --- a/net/http/http_transaction_unittest.cc +++ b/net/http/http_transaction_unittest.cc @@ -105,7 +105,7 @@ static const MockTransaction* const kBuiltinMockTransactions[] = { }; typedef base::hash_map<std::string, const MockTransaction*> - MockTransactionMap; +MockTransactionMap; static MockTransactionMap mock_transactions; void AddMockTransaction(const MockTransaction* trans) { diff --git a/net/http/http_transaction_unittest.h b/net/http/http_transaction_unittest.h index 8a99812..baed540 100644 --- a/net/http/http_transaction_unittest.h +++ b/net/http/http_transaction_unittest.h @@ -35,9 +35,9 @@ enum { TEST_MODE_SYNC_CACHE_START = 1 << 2, TEST_MODE_SYNC_CACHE_READ = 1 << 3, TEST_MODE_SYNC_CACHE_WRITE = 1 << 4, - TEST_MODE_SYNC_ALL = TEST_MODE_SYNC_NET_START | TEST_MODE_SYNC_NET_READ | - TEST_MODE_SYNC_CACHE_START | TEST_MODE_SYNC_CACHE_READ | - TEST_MODE_SYNC_CACHE_WRITE + TEST_MODE_SYNC_ALL = (TEST_MODE_SYNC_NET_START | TEST_MODE_SYNC_NET_READ | + TEST_MODE_SYNC_CACHE_START | TEST_MODE_SYNC_CACHE_READ | + TEST_MODE_SYNC_CACHE_WRITE) }; typedef void (*MockTransactionHandler)(const net::HttpRequestInfo* request, diff --git a/net/http/http_util.cc b/net/http/http_util.cc index 2ca8f02..8168102 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -112,15 +112,16 @@ void HttpUtil::ParseContentType(const string& content_type_str, size_t cur_param_end = FindDelimiter(content_type_str, cur_param_start, ';'); - size_t param_name_start = content_type_str.find_first_not_of(HTTP_LWS, - cur_param_start); + size_t param_name_start = content_type_str.find_first_not_of( + HTTP_LWS, cur_param_start); param_name_start = std::min(param_name_start, cur_param_end); static const char charset_str[] = "charset="; - size_t charset_end_offset = std::min(param_name_start + - sizeof(charset_str) - 1, cur_param_end); - if (LowerCaseEqualsASCII(content_type_str.begin() + param_name_start, - content_type_str.begin() + charset_end_offset, charset_str)) { + size_t charset_end_offset = std::min( + param_name_start + sizeof(charset_str) - 1, cur_param_end); + if (LowerCaseEqualsASCII( + content_type_str.begin() + param_name_start, + content_type_str.begin() + charset_end_offset, charset_str)) { charset_val = param_name_start + sizeof(charset_str) - 1; charset_end = cur_param_end; type_has_charset = true; @@ -160,9 +161,9 @@ void HttpUtil::ParseContentType(const string& content_type_str, content_type_str.find_first_of('/') != string::npos) { // Common case here is that mime_type is empty bool eq = !mime_type->empty() && - LowerCaseEqualsASCII(content_type_str.begin() + type_val, - content_type_str.begin() + type_end, - mime_type->data()); + LowerCaseEqualsASCII(content_type_str.begin() + type_val, + content_type_str.begin() + type_end, + mime_type->data()); if (!eq) { mime_type->assign(content_type_str.begin() + type_val, content_type_str.begin() + type_end); @@ -242,11 +243,11 @@ bool HttpUtil::ParseRangeHeader(const std::string& ranges_specifier, HttpByteRange range; // Try to obtain first-byte-pos. if (!first_byte_pos.empty()) { - int64 first_byte_position = -1; - if (!StringToInt64(first_byte_pos, &first_byte_position)) - return false; - range.set_first_byte_position(first_byte_position); - } + int64 first_byte_position = -1; + if (!StringToInt64(first_byte_pos, &first_byte_position)) + return false; + range.set_first_byte_position(first_byte_position); + } std::string::const_iterator last_byte_pos_begin = byte_range_set_iterator.value_begin() + minus_char_offset + 1; diff --git a/net/http/http_util.h b/net/http/http_util.h index 4d4b200..447e490 100644 --- a/net/http/http_util.h +++ b/net/http/http_util.h @@ -19,14 +19,14 @@ namespace net { class HttpUtil { public: - // Returns the absolute path of the URL, to be used for the http request. - // The absolute path starts with a '/' and may contain a query. - static std::string PathForRequest(const GURL& url); - - // Returns the absolute URL, to be used for the http request. This url is - // made up of the protocol, host, [port], path, [query]. Everything else - // is stripped (username, password, reference). - static std::string SpecForRequest(const GURL& url); + // Returns the absolute path of the URL, to be used for the http request. + // The absolute path starts with a '/' and may contain a query. + static std::string PathForRequest(const GURL& url); + + // Returns the absolute URL, to be used for the http request. This url is + // made up of the protocol, host, [port], path, [query]. Everything else + // is stripped (username, password, reference). + static std::string SpecForRequest(const GURL& url); // Locates the next occurance of delimiter in line, skipping over quoted // strings (e.g., commas will not be treated as delimiters if they appear diff --git a/net/http/http_util_unittest.cc b/net/http/http_util_unittest.cc index bdae329..0c018a2 100644 --- a/net/http/http_util_unittest.cc +++ b/net/http/http_util_unittest.cc @@ -36,21 +36,21 @@ TEST(HttpUtilTest, HasHeader) { TEST(HttpUtilTest, StripHeaders) { static const char* headers = - "Origin: origin\r\n" - "Content-Type: text/plain\r\n" - "Cookies: foo1\r\n" - "Custom: baz\r\n" - "COOKIES: foo2\r\n" - "Server: Apache\r\n" - "OrIGin: origin2\r\n"; + "Origin: origin\r\n" + "Content-Type: text/plain\r\n" + "Cookies: foo1\r\n" + "Custom: baz\r\n" + "COOKIES: foo2\r\n" + "Server: Apache\r\n" + "OrIGin: origin2\r\n"; static const char* header_names[] = { "origin", "content-type", "cookies" }; static const char* expected_stripped_headers = - "Custom: baz\r\n" - "Server: Apache\r\n"; + "Custom: baz\r\n" + "Server: Apache\r\n"; EXPECT_EQ(expected_stripped_headers, HttpUtil::StripHeaders(headers, header_names, diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc index 83bdb3b..f7ab5ea 100644 --- a/net/http/partial_data.cc +++ b/net/http/partial_data.cc @@ -75,8 +75,10 @@ int PartialData::PrepareCacheValidation(disk_cache::Entry* entry, DCHECK(current_range_start_ >= 0); // Scan the disk cache for the first cached portion within this range. - int64 range_len = byte_range_.HasLastBytePosition() ? - byte_range_.last_byte_position() - current_range_start_ + 1 : kint32max; + int64 range_len = + byte_range_.HasLastBytePosition() ? + byte_range_.last_byte_position() - current_range_start_ + 1 : + kint32max; if (range_len > kint32max) range_len = kint32max; int len = static_cast<int32>(range_len); @@ -211,7 +213,7 @@ bool PartialData::ResponseHeadersOK(const HttpResponseHeaders* headers) { // We must have a complete range here. return byte_range_.HasFirstBytePosition() && - byte_range_.HasLastBytePosition(); + byte_range_.HasLastBytePosition(); } int64 start, end, total_length; @@ -313,7 +315,7 @@ int PartialData::CacheRead(disk_cache::Entry* entry, IOBuffer* data, } int PartialData::CacheWrite(disk_cache::Entry* entry, IOBuffer* data, - int data_len, CompletionCallback* callback) { + int data_len, CompletionCallback* callback) { if (sparse_entry_) { return entry->WriteSparseData(current_range_start_, data, data_len, callback); diff --git a/net/http/url_security_manager.h b/net/http/url_security_manager.h index 2665264..70cfcfa 100644 --- a/net/http/url_security_manager.h +++ b/net/http/url_security_manager.h @@ -18,8 +18,8 @@ class HttpAuthFilter; // regarding URL actions (e.g., sending the default credentials to a server). class URLSecurityManager { public: - URLSecurityManager() {} - virtual ~URLSecurityManager() {} + URLSecurityManager() {} + virtual ~URLSecurityManager() {} // Creates a platform-dependent instance of URLSecurityManager. // The URLSecurityManager takes ownership of the HttpAuthFilter. |