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

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

Issue 1800003: Auto-format style pass over files. (Closed)
Patch Set: Remove trailing whitespace. Created 10 years, 7 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_auth_handler_digest.h" 5 #include "net/http/http_auth_handler_digest.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/md5.h" 8 #include "base/md5.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 const std::string& method, 165 const std::string& method,
166 const std::string& path, 166 const std::string& path,
167 const std::string& username, 167 const std::string& username,
168 const std::string& password, 168 const std::string& password,
169 const std::string& cnonce, 169 const std::string& cnonce,
170 int nonce_count) const { 170 int nonce_count) const {
171 // the nonce-count is an 8 digit hex string. 171 // the nonce-count is an 8 digit hex string.
172 std::string nc = StringPrintf("%08x", nonce_count); 172 std::string nc = StringPrintf("%08x", nonce_count);
173 173
174 std::string authorization = std::string("Digest username=") + 174 std::string authorization = std::string("Digest username=") +
175 HttpUtil::Quote(username); 175 HttpUtil::Quote(username);
176 authorization += ", realm=" + HttpUtil::Quote(realm_); 176 authorization += ", realm=" + HttpUtil::Quote(realm_);
177 authorization += ", nonce=" + HttpUtil::Quote(nonce_); 177 authorization += ", nonce=" + HttpUtil::Quote(nonce_);
178 authorization += ", uri=" + HttpUtil::Quote(path); 178 authorization += ", uri=" + HttpUtil::Quote(path);
179 179
180 if (algorithm_ != ALGORITHM_UNSPECIFIED) { 180 if (algorithm_ != ALGORITHM_UNSPECIFIED) {
181 authorization += ", algorithm=" + AlgorithmToString(algorithm_); 181 authorization += ", algorithm=" + AlgorithmToString(algorithm_);
182 } 182 }
183 std::string response = AssembleResponseDigest(method, path, username, 183 std::string response = AssembleResponseDigest(method, path, username,
184 password, cnonce, nc); 184 password, cnonce, nc);
185 // No need to call HttpUtil::Quote() as the response digest cannot contain 185 // No need to call HttpUtil::Quote() as the response digest cannot contain
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // TODO(cbentzel): Move towards model of parsing in the factory 309 // TODO(cbentzel): Move towards model of parsing in the factory
310 // method and only constructing when valid. 310 // method and only constructing when valid.
311 scoped_refptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerDigest()); 311 scoped_refptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerDigest());
312 if (!tmp_handler->InitFromChallenge(challenge, target, origin)) 312 if (!tmp_handler->InitFromChallenge(challenge, target, origin))
313 return ERR_INVALID_RESPONSE; 313 return ERR_INVALID_RESPONSE;
314 handler->swap(tmp_handler); 314 handler->swap(tmp_handler);
315 return OK; 315 return OK;
316 } 316 }
317 317
318 } // namespace net 318 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_basic_unittest.cc ('k') | net/http/http_auth_handler_digest_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698