update_engine: Change Omaha request updater version format
- Remove the "version" attribute of <request>
- Change the value of the "updaterversion" attribute of <request> to be
the pure version number (e.g. change "ChromeOSUpdateEngine-1.0.0.0" to
"1.0.0.0")
- Add the "updater" attribute to <request>, the value of which is the
name of the update client (e.g. "ChromeOSUpdateEngine")
BUG=chromium:928798
TEST=unittests
TEST=cros flashed and the omaha request was:
<?xml version="1.0" encoding="UTF-8"?>
<request protocol="3.0" updater="ChromeOSUpdateEngine" updaterversion="0.1.0.0" installsource="ondemandupdate" ismachine="1">
<os version="Indy" platform="Chrome OS" sp="11756.0.2019_02_13_1337_x86_64"></os>
<app appid="{196C49C7-152F-499B-9C64-F5B8A89E43A4}" version="11756.0.2019_02_13_1337" track="stable-channel" lang="en-US" board="edgar" hardware_class="EDGAR TEST A-A 3472" delta_okay="true" fw_version="" ec_version="" installdate="4340" >
<updatecheck></updatecheck>
<event eventtype="54" eventresult="1" previousversion="11426.0.2018_12_20_1355"></event>
</app>
</request>
Change-Id: I9b1d889fabb539ee64ebe2e4417592a6355dd940
Reviewed-on: https://chromium-review.googlesource.com/1470839
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index f1678ee..deb294a 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -460,22 +460,15 @@
system_state);
}
- string install_source = base::StringPrintf(
- "installsource=\"%s\" ",
- (params->interactive() ? "ondemandupdate" : "scheduler"));
-
- string updater_version = XmlEncodeWithDefault(
- base::StringPrintf(
- "%s-%s", constants::kOmahaUpdaterID, kOmahaUpdaterVersion),
- "");
- string request_xml =
+ string request_xml = base::StringPrintf(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<request protocol=\"3.0\" " +
- ("version=\"" + updater_version +
- "\" "
- "updaterversion=\"" +
- updater_version + "\" " + install_source + "ismachine=\"1\">\n") +
- os_xml + app_xml + "</request>\n";
+ "<request protocol=\"3.0\" updater=\"%s\" updaterversion=\"%s\""
+ " installsource=\"%s\" ismachine=\"1\">\n%s%s</request>\n",
+ constants::kOmahaUpdaterID,
+ kOmahaUpdaterVersion,
+ params->interactive() ? "ondemandupdate" : "scheduler",
+ os_xml.c_str(),
+ app_xml.c_str());
return request_xml;
}