OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "update_engine/update_check_action.h" | 5 #include "update_engine/update_check_action.h" |
6 #include <inttypes.h> | 6 #include <inttypes.h> |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include <libxml/parser.h> | 9 #include <libxml/parser.h> |
10 #include <libxml/xpath.h> | 10 #include <libxml/xpath.h> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 public: | 56 public: |
57 inline void operator()(void* x) const { | 57 inline void operator()(void* x) const { |
58 xmlXPathFreeContext(reinterpret_cast<xmlXPathContext*>(x)); | 58 xmlXPathFreeContext(reinterpret_cast<xmlXPathContext*>(x)); |
59 } | 59 } |
60 }; | 60 }; |
61 | 61 |
62 // Returns a properly formatted omaha request for an update check | 62 // Returns a properly formatted omaha request for an update check |
63 string FormatRequest(const UpdateCheckParams& params) { | 63 string FormatRequest(const UpdateCheckParams& params) { |
64 return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | 64 return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
65 "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" " | 65 "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" " |
66 "version=\"" + XmlEncode(kGupdateVersion) + "\" protocol=\"2.0\" " | 66 "version=\"" + XmlEncode(kGupdateVersion) + "\" " |
| 67 "updaterversion=\"" + XmlEncode(kGupdateVersion) + "\" " |
| 68 "protocol=\"2.0\" " |
67 "machineid=\"") + XmlEncode(params.machine_id) + "\" ismachine=\"1\" " | 69 "machineid=\"") + XmlEncode(params.machine_id) + "\" ismachine=\"1\" " |
68 "userid=\"" + XmlEncode(params.user_id) + "\">\n" | 70 "userid=\"" + XmlEncode(params.user_id) + "\">\n" |
69 " <o:os version=\"" + XmlEncode(params.os_version) + "\" platform=\"" + | 71 " <o:os version=\"" + XmlEncode(params.os_version) + "\" platform=\"" + |
70 XmlEncode(params.os_platform) + "\" sp=\"" + | 72 XmlEncode(params.os_platform) + "\" sp=\"" + |
71 XmlEncode(params.os_sp) + "\"></o:os>\n" | 73 XmlEncode(params.os_sp) + "\"></o:os>\n" |
72 " <o:app appid=\"" + XmlEncode(params.app_id) + "\" version=\"" + | 74 " <o:app appid=\"" + XmlEncode(params.app_id) + "\" version=\"" + |
73 XmlEncode(params.app_version) + "\" " | 75 XmlEncode(params.app_version) + "\" " |
74 "lang=\"" + XmlEncode(params.app_lang) + "\" track=\"" + | 76 "lang=\"" + XmlEncode(params.app_lang) + "\" track=\"" + |
75 XmlEncode(params.app_track) + "\">\n" | 77 XmlEncode(params.app_track) + "\">\n" |
76 " <o:ping active=\"0\"></o:ping>\n" | 78 " <o:ping active=\"0\"></o:ping>\n" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 output_object.hash = XmlGetProperty(updatecheck_node, "hash"); | 265 output_object.hash = XmlGetProperty(updatecheck_node, "hash"); |
264 output_object.size = ParseInt(XmlGetProperty(updatecheck_node, "size")); | 266 output_object.size = ParseInt(XmlGetProperty(updatecheck_node, "size")); |
265 output_object.needs_admin = | 267 output_object.needs_admin = |
266 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; | 268 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; |
267 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; | 269 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; |
268 SetOutputObject(output_object); | 270 SetOutputObject(output_object); |
269 return; | 271 return; |
270 } | 272 } |
271 | 273 |
272 }; // namespace chromeos_update_engine | 274 }; // namespace chromeos_update_engine |
OLD | NEW |