mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-18 15:28:11 +00:00
Timeout for stream file.
This commit is contained in:
@ -337,12 +337,13 @@ class Compute:
|
||||
return response
|
||||
|
||||
@asyncio.coroutine
|
||||
def stream_file(self, project, path):
|
||||
def stream_file(self, project, path, timeout=None):
|
||||
"""
|
||||
Read file of a project and stream it
|
||||
|
||||
:param project: A project object
|
||||
:param path: The path of the file in the project
|
||||
:param timeout: timeout
|
||||
:returns: A file stream
|
||||
"""
|
||||
|
||||
@ -361,7 +362,7 @@ class Compute:
|
||||
self._response.close()
|
||||
|
||||
url = self._getUrl("/projects/{}/stream/{}".format(project.id, path))
|
||||
response = yield from self._session().request("GET", url, auth=self._auth, timeout=None)
|
||||
response = yield from self._session().request("GET", url, auth=self._auth, timeout=timeout)
|
||||
if response.status == 404:
|
||||
raise aiohttp.web.HTTPNotFound(text="{} not found on compute".format(path))
|
||||
elif response.status == 403:
|
||||
|
Reference in New Issue
Block a user