update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try

Signed-off-by: Jeremy Mordkoff <Jeremy.Mordkoff@riftio.com>
diff --git a/common/python/rift/downloader/base.py b/common/python/rift/downloader/base.py
index c87839f..c36b989 100644
--- a/common/python/rift/downloader/base.py
+++ b/common/python/rift/downloader/base.py
@@ -107,8 +107,7 @@
         self.progress_percent = 0
         self.bytes_downloaded = 0
         self.bytes_per_second = 0
-
-
+        self.status = None
         self.start_time = 0
         self.stop_time = 0
         self.detail = ""
diff --git a/common/python/rift/downloader/local_file.py b/common/python/rift/downloader/local_file.py
new file mode 100644
index 0000000..c6e9c5e
--- /dev/null
+++ b/common/python/rift/downloader/local_file.py
@@ -0,0 +1,84 @@
+#
+#   Copyright 2016 RIFT.IO Inc
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# Taken from http://stackoverflow.com/a/27786580
+
+
+import logging
+import requests
+import os
+from urllib.parse import urlparse
+
+
+class LocalFileAdapter(requests.adapters.BaseAdapter):
+    """Protocol Adapter to allow Requests to GET file:// URLs
+
+    @todo: Properly handle non-empty hostname portions.
+    """
+
+    @staticmethod
+    def _chkpath(method, path):
+        """Return an HTTP status for the given filesystem path."""
+        if method.lower() in ('put', 'delete'):
+            return 501, "Not Implemented"  # TODO
+        elif method.lower() not in ('get', 'head'):
+            return 405, "Method Not Allowed"
+        elif os.path.isdir(path):
+            return 400, "Path Not A File"
+        elif not os.path.isfile(path):
+            return 404, "File Not Found"
+        elif not os.access(path, os.R_OK):
+            return 403, "Access Denied"
+        else:
+            return 200, "OK"
+
+    def send(self, req, **kwargs):  # pylint: disable=unused-argument
+        """Return the file specified by the given request
+
+        @type req: C{PreparedRequest}
+        @todo: Should I bother filling `response.headers` and processing
+               If-Modified-Since and friends using `os.stat`?
+        """
+
+        log = logging.getLogger('rw-mano-log')
+        log.debug("Request: {}".format(req))
+
+        url = urlparse(req.path_url)
+        path = os.path.normcase(os.path.normpath(url.path))
+        response = requests.Response()
+
+        response.status_code, response.reason = self._chkpath(req.method, path)
+        log.debug("Response {}: {}".format(response.status_code, response.reason))
+        if response.status_code == 200 and req.method.lower() != 'head':
+            try:
+                response.raw = open(path, 'rb')
+            except (OSError, IOError) as err:
+                response.status_code = 500
+                response.reason = str(err)
+
+        if isinstance(req.url, bytes):
+            response.url = req.url.decode('utf-8')
+        else:
+            response.url = req.url
+
+        response.request = req
+        response.connection = self
+
+
+        log.debug("Response {}: {}".format(response.status_code, response))
+        return response
+
+    def close(self):
+        pass
diff --git a/common/python/rift/downloader/url.py b/common/python/rift/downloader/url.py
index b6921c5..3aa9ac2 100644
--- a/common/python/rift/downloader/url.py
+++ b/common/python/rift/downloader/url.py
@@ -34,6 +34,7 @@
 requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
 
 from . import base
+from .local_file import LocalFileAdapter as LocalFileAdapter
 
 class UrlDownloader(base.AbstractDownloader):
     """Handles downloads of URL with some basic retry strategy.
@@ -105,6 +106,7 @@
         retries = Retry(total=2, backoff_factor=1)
         session.mount("http://", HTTPAdapter(max_retries=retries))
         session.mount("https://", HTTPAdapter(max_retries=retries))
+        session.mount("file://", LocalFileAdapter())
 
         return session
 
@@ -196,7 +198,7 @@
         self.meta.update_data_with_head(response.headers)
         self.meta.start_download()
 
-        self.download_started()
+        self.download_progress()
 
         url_options["stream"] = True,
         request = self.session.get(self.url, **url_options)
@@ -218,7 +220,7 @@
                 chunk = self.check_and_decompress(chunk)
 
                 self._fh.write(chunk)
-                self.download_progress()
+                #self.download_progress()
 
         self.meta.end_download()
         self.close()