net: Remove extra spaces from WinHttp log messages

I recently (90054edf6202) removed the extra spaces from ntdll log
messages. The winhttp messages have the same problem.

Context:
https://groups.google.com/a/chromium.org/d/topic/crashpad-dev/kD3a9Jekzx0

Change-Id: I49682ba99c3dfe1cd4c49507806cf8adf154bc9f
Reviewed-on: https://chromium-review.googlesource.com/749305
Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
Mark Mentovai 2017-11-01 11:24:33 -04:00
parent 1669ca2bac
commit c542a5ae03

View File

@ -101,6 +101,12 @@ std::string WinHttpMessage(const char* extra) {
GetLastError(), GetLastError(),
error_code); error_code);
} }
// Most system messages end in a space. Remove the space if its there,
// because the StringPrintf() below includes one.
if (len >= 1 && msgbuf[len - 1] == ' ') {
msgbuf[len - 1] = '\0';
}
return base::StringPrintf("%s: %s (0x%lx)", extra, msgbuf, error_code); return base::StringPrintf("%s: %s (0x%lx)", extra, msgbuf, error_code);
} }