gs_archive_server: download content when request is not HEAD

StreamingCat method is called in download RPC even when the request is a
HEAD request. Add a check to see if the request is HEAD or GET and call
StreamingCat only when it is GET.

BUG=chromium:1077020
TEST=Tested on chromeos2-devservertest using steps in description on the
bug

Change-Id: I51bade777db70bb7b085e250b67374c82122baf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2200073
Tested-by: Sanika Kulkarni <sanikak@chromium.org>
Commit-Queue: Sanika Kulkarni <sanikak@chromium.org>
Auto-Submit: Sanika Kulkarni <sanikak@chromium.org>
Reviewed-by: Congbin Guo <guocb@chromium.org>
diff --git a/gs_cache/gs_archive_server.py b/gs_cache/gs_archive_server.py
index db3f9c7..55513f3 100644
--- a/gs_cache/gs_archive_server.py
+++ b/gs_cache/gs_archive_server.py
@@ -347,11 +347,13 @@
       The stream of downloaded file.
     """
     path = 'gs://%s' % _check_file_extension('/'.join(args))
+    content = None
 
-    _log('Downloading %s', path, level=logging.INFO)
     try:
       stat = self._gsutil.Stat(path)
-      content = self._gsutil.StreamingCat(path)
+      if cherrypy.request.method == 'GET':
+        _log('Downloading %s', path, level=logging.INFO)
+        content = self._gsutil.StreamingCat(path)
     except gs.GSNoSuchKey as err:
       raise cherrypy.HTTPError(httplib.NOT_FOUND, err.message)
     except gs.GSCommandError as err:
@@ -367,7 +369,6 @@
         'Accept-Ranges': 'bytes',
         'Content-Length': stat.content_length,
     })
-    _log('Download complete.')
 
     return content