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

Unified Diff: google_apis/gaia/gaia_auth_fetcher.cc

Issue 11991002: Merge 176800 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/gaia/gaia_auth_fetcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/gaia_auth_fetcher.cc
===================================================================
--- google_apis/gaia/gaia_auth_fetcher.cc (revision 177312)
+++ google_apis/gaia/gaia_auth_fetcher.cc (working copy)
@@ -21,6 +21,7 @@
#include "google_apis/gaia/google_service_auth_error.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
+#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
@@ -156,6 +157,9 @@
// static
const char GaiaAuthFetcher::kOAuthHeaderFormat[] = "Authorization: OAuth %s";
// static
+const char GaiaAuthFetcher::kOAuth2BearerHeaderFormat[] =
+ "Authorization: Bearer %s";
+// static
const char GaiaAuthFetcher::kClientLoginToOAuth2CookiePartSecure[] = "Secure";
// static
const char GaiaAuthFetcher::kClientLoginToOAuth2CookiePartHttpOnly[] =
@@ -354,7 +358,9 @@
using std::vector;
using std::pair;
using std::string;
-
+ sid->clear();
+ lsid->clear();
+ token->clear();
vector<pair<string, string> > tokens;
base::SplitStringIntoKeyValuePairs(data, '=', '\n', &tokens);
for (vector<pair<string, string> >::iterator i = tokens.begin();
@@ -367,6 +373,10 @@
token->assign(i->second);
}
}
+ // If this was a request for uberauth token, then that's all we've got in
+ // data.
+ if (sid->empty() && lsid->empty() && token->empty())
+ token->assign(data);
}
// static
@@ -434,7 +444,8 @@
const std::string& source) {
std::string encoded_service = net::EscapeUrlEncodedData(service, true);
std::string encoded_source = net::EscapeUrlEncodedData(source, true);
- return StringPrintf(kOAuthLoginFormat, encoded_service.c_str(),
+ return StringPrintf(kOAuthLoginFormat,
+ encoded_service.c_str(),
encoded_source.c_str());
}
@@ -770,7 +781,7 @@
request_body_ = MakeOAuthLoginBody(service, source_);
std::string authentication_header =
- base::StringPrintf("Authorization: Bearer %s", access_token.c_str());
+ base::StringPrintf(kOAuth2BearerHeaderFormat, access_token.c_str());
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
authentication_header,
@@ -1072,8 +1083,16 @@
int response_code = source->GetResponseCode();
std::string data;
source->GetResponseAsString(&data);
- DVLOG(2) << "Gaia fetcher response code: " << response_code;
- DVLOG(2) << "Gaia fetcher response data: " << data;
+#ifndef NDEBUG
+ std::string headers;
+ if (source->GetResponseHeaders())
+ source->GetResponseHeaders()->GetNormalizedHeaders(&headers);
+ DVLOG(2) << "Response " << url.spec() << ", code = " << response_code << "\n"
+ << headers << "\n";
+ DVLOG(2) << "data: " << data << "\n";
+#endif
+ // Retrieve the response headers from the request. Must only be called after
+ // the OnURLFetchComplete callback has run.
if (url == client_login_gurl_) {
OnClientLoginFetched(data, status, response_code);
} else if (url == issue_auth_token_gurl_) {
« no previous file with comments | « google_apis/gaia/gaia_auth_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698