Pick last instead of first URL in v3 clients for now.

We have a design underway for trying out all the URLs in the Omaha rules.
But update_engine has already been modified to be v3 and pick the first
URL. What this means is that any bits released until the full design gets
implemented, in future, when we actually populate multiple URLs such as
HTTP and HTTPs, will pick HTTP and fail because it doesn't have the full
support to process HTTP URLs.

So we need to change that logic to always pick the last one. This is
based on the assumption that the last one will be more stable (e.g. HTTPS).

BUG=chromium-os:36724
TEST=Tested on ZGB with devserver by supplying multiple URLs.

Change-Id: I85291dae56c9be83eb83955d6e123cdb8e33f28a
Reviewed-on: https://gerrit.chromium.org/gerrit/38827
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index d2399c1..3c86c6b 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -443,10 +443,10 @@
   CHECK(nodeset) << "XPath missing " << kUpdateUrlNodeXPath;
   CHECK_GE(nodeset->nodeNr, 1);
 
-  // TODO(jaysri): For now, just process only the first URL. In subsequent
+  // TODO(jaysri): For now, use the last URL. In subsequent
   // check-ins, we'll add the support to honor multiples URLs.
-  LOG(INFO) << "Processing first of " << nodeset->nodeNr << " url(s)";
-  xmlNode* url_node = nodeset->nodeTab[0];
+  LOG(INFO) << "Processing last of " << nodeset->nodeNr << " url(s)";
+  xmlNode* url_node = nodeset->nodeTab[nodeset->nodeNr - 1];
 
   const string codebase(XmlGetProperty(url_node, "codebase"));
   if (codebase.empty()) {