Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1206)

Side by Side Diff: net/http/http_network_transaction.cc

Issue 17471: Measure how often the users are encountering MD5... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/build/net.vcproj ('k') | net/net.xcodeproj/project.pbxproj » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/trace_event.h" 10 #include "base/trace_event.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "net/base/client_socket_factory.h" 12 #include "net/base/client_socket_factory.h"
13 #include "net/base/connection_type_histograms.h"
13 #include "net/base/dns_resolution_observer.h" 14 #include "net/base/dns_resolution_observer.h"
14 #include "net/base/host_resolver.h" 15 #include "net/base/host_resolver.h"
15 #include "net/base/load_flags.h" 16 #include "net/base/load_flags.h"
16 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
17 #include "net/base/ssl_client_socket.h" 18 #include "net/base/ssl_client_socket.h"
18 #include "net/base/upload_data_stream.h" 19 #include "net/base/upload_data_stream.h"
19 #include "net/http/http_auth.h" 20 #include "net/http/http_auth.h"
20 #include "net/http/http_auth_handler.h" 21 #include "net/http/http_auth_handler.h"
21 #include "net/http/http_chunked_decoder.h" 22 #include "net/http/http_chunked_decoder.h"
22 #include "net/http/http_network_session.h" 23 #include "net/http/http_network_session.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 read_buf_len_(0), 56 read_buf_len_(0),
56 next_state_(STATE_NONE) { 57 next_state_(STATE_NONE) {
57 #if defined(OS_WIN) 58 #if defined(OS_WIN)
58 // TODO(port): Port the SSLConfigService class to Linux and Mac OS X. 59 // TODO(port): Port the SSLConfigService class to Linux and Mac OS X.
59 session->ssl_config_service()->GetSSLConfig(&ssl_config_); 60 session->ssl_config_service()->GetSSLConfig(&ssl_config_);
60 #endif 61 #endif
61 } 62 }
62 63
63 int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info, 64 int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info,
64 CompletionCallback* callback) { 65 CompletionCallback* callback) {
66 UpdateConnectionTypeHistograms(CONNECTION_ANY);
67
65 request_ = request_info; 68 request_ = request_info;
66 69
67 next_state_ = STATE_RESOLVE_PROXY; 70 next_state_ = STATE_RESOLVE_PROXY;
68 int rv = DoLoop(OK); 71 int rv = DoLoop(OK);
69 if (rv == ERR_IO_PENDING) 72 if (rv == ERR_IO_PENDING)
70 user_callback_ = callback; 73 user_callback_ = callback;
71 return rv; 74 return rv;
72 } 75 }
73 76
74 int HttpNetworkTransaction::RestartIgnoringLastError( 77 int HttpNetworkTransaction::RestartIgnoringLastError(
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 } else { 1050 } else {
1048 rv = error; 1051 rv = error;
1049 } 1052 }
1050 1053
1051 return rv; 1054 return rv;
1052 } 1055 }
1053 1056
1054 void HttpNetworkTransaction::AddAuthorizationHeader(HttpAuth::Target target) { 1057 void HttpNetworkTransaction::AddAuthorizationHeader(HttpAuth::Target target) {
1055 // If we have no authentication information, check if we can select 1058 // If we have no authentication information, check if we can select
1056 // a cache entry preemptively (based on the path). 1059 // a cache entry preemptively (based on the path).
1057 if(!HaveAuth(target) && !SelectPreemptiveAuth(target)) 1060 if (!HaveAuth(target) && !SelectPreemptiveAuth(target))
1058 return; 1061 return;
1059 1062
1060 DCHECK(HaveAuth(target)); 1063 DCHECK(HaveAuth(target));
1061 1064
1062 // Add a Authorization/Proxy-Authorization header line. 1065 // Add a Authorization/Proxy-Authorization header line.
1063 std::string credentials = auth_handler_[target]->GenerateCredentials( 1066 std::string credentials = auth_handler_[target]->GenerateCredentials(
1064 auth_identity_[target].username, 1067 auth_identity_[target].username,
1065 auth_identity_[target].password, 1068 auth_identity_[target].password,
1066 request_, 1069 request_,
1067 &proxy_info_); 1070 &proxy_info_);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 // the preemptively used auth entry matches the realm of the subsequent 1110 // the preemptively used auth entry matches the realm of the subsequent
1108 // challenge, then we can invalidate the preemptively used entry. 1111 // challenge, then we can invalidate the preemptively used entry.
1109 // Otherwise as-is we may send the failed credentials one extra time. 1112 // Otherwise as-is we may send the failed credentials one extra time.
1110 if (auth_identity_[target].source == HttpAuth::IDENT_SRC_PATH_LOOKUP) 1113 if (auth_identity_[target].source == HttpAuth::IDENT_SRC_PATH_LOOKUP)
1111 return; 1114 return;
1112 1115
1113 // Clear the cache entry for the identity we just failed on. 1116 // Clear the cache entry for the identity we just failed on.
1114 // Note: we require the username/password to match before invalidating 1117 // Note: we require the username/password to match before invalidating
1115 // since the entry in the cache may be newer than what we used last time. 1118 // since the entry in the cache may be newer than what we used last time.
1116 session_->auth_cache()->Remove(AuthOrigin(target), 1119 session_->auth_cache()->Remove(AuthOrigin(target),
1117 auth_handler_[target]->realm(), 1120 auth_handler_[target]->realm(),
1118 auth_identity_[target].username, 1121 auth_identity_[target].username,
1119 auth_identity_[target].password); 1122 auth_identity_[target].password);
1120 } 1123 }
1121 1124
1122 bool HttpNetworkTransaction::SelectPreemptiveAuth(HttpAuth::Target target) { 1125 bool HttpNetworkTransaction::SelectPreemptiveAuth(HttpAuth::Target target) {
1123 DCHECK(!HaveAuth(target)); 1126 DCHECK(!HaveAuth(target));
1124 1127
1125 // Don't do preemptive authorization if the URL contains a username/password, 1128 // Don't do preemptive authorization if the URL contains a username/password,
1126 // since we must first be challenged in order to use the URL's identity. 1129 // since we must first be challenged in order to use the URL's identity.
1127 if (request_->url.has_username()) 1130 if (request_->url.has_username())
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 if (target == HttpAuth::AUTH_PROXY) { 1261 if (target == HttpAuth::AUTH_PROXY) {
1259 auth_info->host = ASCIIToWide(proxy_info_.proxy_server()); 1262 auth_info->host = ASCIIToWide(proxy_info_.proxy_server());
1260 } else { 1263 } else {
1261 DCHECK(target == HttpAuth::AUTH_SERVER); 1264 DCHECK(target == HttpAuth::AUTH_SERVER);
1262 auth_info->host = ASCIIToWide(request_->url.host()); 1265 auth_info->host = ASCIIToWide(request_->url.host());
1263 } 1266 }
1264 response_.auth_challenge = auth_info; 1267 response_.auth_challenge = auth_info;
1265 } 1268 }
1266 1269
1267 } // namespace net 1270 } // namespace net
OLDNEW
« no previous file with comments | « net/build/net.vcproj ('k') | net/net.xcodeproj/project.pbxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698