Commit aaab25e2 authored by Eric Roman's avatar Eric Roman Committed by Commit Bot

Log the net_error code when AttestationCAClient fails.

(Previously it would just print -1 if the request failed due to a network error)

Change-Id: I5f61bc4461f109c733f56983ac0420b0e5083c27
Reviewed-on: https://chromium-review.googlesource.com/c/1327575Reviewed-by: default avatarYves Arrouye <drcrash@chromium.org>
Commit-Queue: Eric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606657}
parent f9fdd402
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "net/base/load_flags.h" #include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h" #include "net/http/http_status_code.h"
#include "net/url_request/url_request_status.h" #include "net/url_request/url_request_status.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
...@@ -86,20 +87,21 @@ void AttestationCAClient::OnURLLoadComplete( ...@@ -86,20 +87,21 @@ void AttestationCAClient::OnURLLoadComplete(
DCHECK(url_loader); DCHECK(url_loader);
int response_code = -1;
if (url_loader->ResponseInfo() && url_loader->ResponseInfo()->headers) { if (url_loader->ResponseInfo() && url_loader->ResponseInfo()->headers) {
response_code = url_loader->ResponseInfo()->headers->response_code(); int response_code = url_loader->ResponseInfo()->headers->response_code();
}
if (response_code < 200 || response_code > 299) {
if (response_code < 200 || response_code > 299) { LOG(ERROR) << "Attestation CA sent an HTTP error response: "
LOG(ERROR) << "Attestation CA sent an error response: " << response_code; << response_code;
callback.Run(false, ""); callback.Run(false, "");
return; return;
}
} }
if (!response_body) { if (!response_body) {
int net_error = url_loader->NetError();
LOG(ERROR) << "Attestation CA request failed, error: " LOG(ERROR) << "Attestation CA request failed, error: "
<< url_loader->NetError(); << net::ErrorToString(net_error);
callback.Run(false, ""); callback.Run(false, "");
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment