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

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

Issue 8340026: Use AuthCredentials throughout the network stack instead of username/password. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: mac compile fix Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // Reset the other member variables. 196 // Reset the other member variables.
197 // Note: this is necessary only with SSL renegotiation. 197 // Note: this is necessary only with SSL renegotiation.
198 ResetStateForRestart(); 198 ResetStateForRestart();
199 next_state_ = STATE_CREATE_STREAM; 199 next_state_ = STATE_CREATE_STREAM;
200 int rv = DoLoop(OK); 200 int rv = DoLoop(OK);
201 if (rv == ERR_IO_PENDING) 201 if (rv == ERR_IO_PENDING)
202 user_callback_ = callback; 202 user_callback_ = callback;
203 return rv; 203 return rv;
204 } 204 }
205 205
206 int HttpNetworkTransaction::RestartWithAuth( 206 int HttpNetworkTransaction::RestartWithAuth(const AuthCredentials& credentials,
207 const string16& username, 207 OldCompletionCallback* callback) {
208 const string16& password,
209 OldCompletionCallback* callback) {
210 HttpAuth::Target target = pending_auth_target_; 208 HttpAuth::Target target = pending_auth_target_;
211 if (target == HttpAuth::AUTH_NONE) { 209 if (target == HttpAuth::AUTH_NONE) {
212 NOTREACHED(); 210 NOTREACHED();
213 return ERR_UNEXPECTED; 211 return ERR_UNEXPECTED;
214 } 212 }
215 pending_auth_target_ = HttpAuth::AUTH_NONE; 213 pending_auth_target_ = HttpAuth::AUTH_NONE;
216 214
217 auth_controllers_[target]->ResetAuth(username, password); 215 auth_controllers_[target]->ResetAuth(credentials);
218 216
219 DCHECK(user_callback_ == NULL); 217 DCHECK(user_callback_ == NULL);
220 218
221 int rv = OK; 219 int rv = OK;
222 if (target == HttpAuth::AUTH_PROXY && establishing_tunnel_) { 220 if (target == HttpAuth::AUTH_PROXY && establishing_tunnel_) {
223 // In this case, we've gathered credentials for use with proxy 221 // In this case, we've gathered credentials for use with proxy
224 // authentication of a tunnel. 222 // authentication of a tunnel.
225 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); 223 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_);
226 DCHECK(stream_request_ != NULL); 224 DCHECK(stream_request_ != NULL);
227 auth_controllers_[target] = NULL; 225 auth_controllers_[target] = NULL;
228 ResetStateForRestart(); 226 ResetStateForRestart();
229 rv = stream_request_->RestartTunnelWithProxyAuth(username, password); 227 rv = stream_request_->RestartTunnelWithProxyAuth(credentials);
230 } else { 228 } else {
231 // In this case, we've gathered credentials for the server or the proxy 229 // In this case, we've gathered credentials for the server or the proxy
232 // but it is not during the tunneling phase. 230 // but it is not during the tunneling phase.
233 DCHECK(stream_request_ == NULL); 231 DCHECK(stream_request_ == NULL);
234 PrepareForAuthRestart(target); 232 PrepareForAuthRestart(target);
235 rv = DoLoop(OK); 233 rv = DoLoop(OK);
236 } 234 }
237 235
238 if (rv == ERR_IO_PENDING) 236 if (rv == ERR_IO_PENDING)
239 user_callback_ = callback; 237 user_callback_ = callback;
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1340 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1343 state); 1341 state);
1344 break; 1342 break;
1345 } 1343 }
1346 return description; 1344 return description;
1347 } 1345 }
1348 1346
1349 #undef STATE_CASE 1347 #undef STATE_CASE
1350 1348
1351 } // namespace net 1349 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698