cros_sdk: adjust error checking in RemoteTarballExists for multiple layers

This CL changes the error checking logic in RemoteTarballExists to check for
'200 OK' on multiple lines returned in the header. This enables other
underlying networking tools to be used, such as proxy services, which happen
to output other messages before the curl header output.

BUG=None
TEST=Manual, verify cros_sdk still runs correctly downloading SDK.

Change-Id: I15fdf3c2c8858bc99dc38c993b2b9a0f42081e4a
Reviewed-on: https://gerrit.chromium.org/gerrit/23933
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index 7cb96e0..5f66fa6 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -129,8 +129,13 @@
     result = RunCurl(['-I', url],
                      redirect_stdout=True, redirect_stderr=True,
                      print_cmd=False)
-    header = result.output.splitlines()[0]
-    return header.find('200 OK') != -1
+    # We must walk the output to find the string '200 OK' for use cases where
+    # a proxy is involved and may have pushed down the actual header.
+    for header in result.output.splitlines():
+      if header.find('200 OK') != -1:
+        return 1
+    return 0
+
 
   url = None
   for url in urls: