Bug 1381718 : Dump request when receiving 400 error r=hchang

MozReview-Commit-ID: 1ZFOIRTryiV

--HG--
extra : rebase_source : b0377d006b1b190c4a77ca4b26ce9d12efc0c464
This commit is contained in:
Thomas Nguyen 2017-07-25 14:43:11 +08:00
Родитель 04ef4d11b8
Коммит 0ed363ec89
2 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -428,16 +428,16 @@ HashCompleterRequest.prototype = {
let loadFlags = Ci.nsIChannel.INHIBIT_CACHING |
Ci.nsIChannel.LOAD_BYPASS_CACHE;
let actualGethashUrl = this.gethashUrl;
this.actualGethashUrl = this.gethashUrl;
if (this.isV4) {
// As per spec, we add the request payload to the gethash url.
actualGethashUrl += "&$req=" + this.buildRequestV4();
this.actualGethashUrl += "&$req=" + this.buildRequestV4();
}
log("actualGethashUrl: " + actualGethashUrl);
log("actualGethashUrl: " + this.actualGethashUrl);
let channel = NetUtil.newChannel({
uri: actualGethashUrl,
uri: this.actualGethashUrl,
loadUsingSystemPrincipal: true
});
channel.loadFlags = loadFlags;
@ -765,6 +765,11 @@ HashCompleterRequest.prototype = {
Services.telemetry.getKeyedHistogramById("URLCLASSIFIER_COMPLETE_REMOTE_STATUS2").
add(this.telemetryProvider, httpStatusToBucket(httpStatus));
if (httpStatus == 400) {
dump("Safe Browsing server returned a 400 during completion: request= " +
this.actualGethashUrl + "\n");
}
Services.telemetry.getKeyedHistogramById("URLCLASSIFIER_COMPLETE_TIMEOUT2").
add(this.telemetryProvider, 0);

Просмотреть файл

@ -774,6 +774,17 @@ nsUrlClassifierStreamUpdater::OnStartRequest(nsIRequest *request,
NS_ENSURE_SUCCESS(rv, rv);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_REMOTE_STATUS2,
mTelemetryProvider, HTTPStatusToBucket(requestStatus));
if (requestStatus == 400) {
nsCOMPtr<nsIURI> uri;
nsAutoCString spec;
rv = httpChannel->GetURI(getter_AddRefs(uri));
if (NS_SUCCEEDED(rv) && uri) {
uri->GetAsciiSpec(spec);
}
printf_stderr("Safe Browsing server returned a 400 during update: request = %s \n",
spec.get());
}
LOG(("nsUrlClassifierStreamUpdater::OnStartRequest %s (%d)", succeeded ?
"succeeded" : "failed", requestStatus));
if (!succeeded) {