mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Fix the GUI disconnect from the server
Fix https://github.com/GNS3/gns3-gui/issues/2084
This commit is contained in:
parent
89394ba7e0
commit
7044c8c9ff
@ -156,7 +156,6 @@ class ProjectHandler:
|
|||||||
response.content_type = "application/json"
|
response.content_type = "application/json"
|
||||||
response.set_status(200)
|
response.set_status(200)
|
||||||
response.enable_chunked_encoding()
|
response.enable_chunked_encoding()
|
||||||
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
|
||||||
|
|
||||||
response.start(request)
|
response.start(request)
|
||||||
queue = project.get_listen_queue()
|
queue = project.get_listen_queue()
|
||||||
@ -238,7 +237,6 @@ class ProjectHandler:
|
|||||||
response.content_type = "application/octet-stream"
|
response.content_type = "application/octet-stream"
|
||||||
response.set_status(200)
|
response.set_status(200)
|
||||||
response.enable_chunked_encoding()
|
response.enable_chunked_encoding()
|
||||||
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
@ -280,7 +278,6 @@ class ProjectHandler:
|
|||||||
response.content_type = "application/octet-stream"
|
response.content_type = "application/octet-stream"
|
||||||
response.set_status(200)
|
response.set_status(200)
|
||||||
response.enable_chunked_encoding()
|
response.enable_chunked_encoding()
|
||||||
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
@ -354,7 +351,6 @@ class ProjectHandler:
|
|||||||
response.content_type = 'application/gns3project'
|
response.content_type = 'application/gns3project'
|
||||||
response.headers['CONTENT-DISPOSITION'] = 'attachment; filename="{}.gns3project"'.format(project.name)
|
response.headers['CONTENT-DISPOSITION'] = 'attachment; filename="{}.gns3project"'.format(project.name)
|
||||||
response.enable_chunked_encoding()
|
response.enable_chunked_encoding()
|
||||||
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
|
||||||
yield from response.prepare(request)
|
yield from response.prepare(request)
|
||||||
|
|
||||||
include_images = bool(int(request.json.get("include_images", "0")))
|
include_images = bool(int(request.json.get("include_images", "0")))
|
||||||
|
@ -178,7 +178,6 @@ class LinkHandler:
|
|||||||
response.content_type = "application/vnd.tcpdump.pcap"
|
response.content_type = "application/vnd.tcpdump.pcap"
|
||||||
response.set_status(200)
|
response.set_status(200)
|
||||||
response.enable_chunked_encoding()
|
response.enable_chunked_encoding()
|
||||||
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
|
||||||
yield from response.prepare(request)
|
yield from response.prepare(request)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
@ -210,7 +210,6 @@ class ProjectHandler:
|
|||||||
response.content_type = "application/json"
|
response.content_type = "application/json"
|
||||||
response.set_status(200)
|
response.set_status(200)
|
||||||
response.enable_chunked_encoding()
|
response.enable_chunked_encoding()
|
||||||
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
|
||||||
|
|
||||||
yield from response.prepare(request)
|
yield from response.prepare(request)
|
||||||
with controller.notification.queue(project) as queue:
|
with controller.notification.queue(project) as queue:
|
||||||
@ -292,7 +291,6 @@ class ProjectHandler:
|
|||||||
response.content_type = 'application/gns3project'
|
response.content_type = 'application/gns3project'
|
||||||
response.headers['CONTENT-DISPOSITION'] = 'attachment; filename="{}.gns3project"'.format(project.name)
|
response.headers['CONTENT-DISPOSITION'] = 'attachment; filename="{}.gns3project"'.format(project.name)
|
||||||
response.enable_chunked_encoding()
|
response.enable_chunked_encoding()
|
||||||
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
|
||||||
yield from response.prepare(request)
|
yield from response.prepare(request)
|
||||||
|
|
||||||
for data in datas:
|
for data in datas:
|
||||||
@ -404,7 +402,6 @@ class ProjectHandler:
|
|||||||
response.content_type = "application/octet-stream"
|
response.content_type = "application/octet-stream"
|
||||||
response.set_status(200)
|
response.set_status(200)
|
||||||
response.enable_chunked_encoding()
|
response.enable_chunked_encoding()
|
||||||
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
|
@ -44,6 +44,11 @@ class Response(aiohttp.web.Response):
|
|||||||
headers['Server'] = "Python/{0[0]}.{0[1]} GNS3/{1}".format(sys.version_info, __version__)
|
headers['Server'] = "Python/{0[0]}.{0[1]} GNS3/{1}".format(sys.version_info, __version__)
|
||||||
super().__init__(headers=headers, **kwargs)
|
super().__init__(headers=headers, **kwargs)
|
||||||
|
|
||||||
|
def enable_chunked_encoding():
|
||||||
|
# Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed)
|
||||||
|
response.content_length = None
|
||||||
|
super().enable_chunked_encoding()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def prepare(self, request):
|
def prepare(self, request):
|
||||||
if log.getEffectiveLevel() == logging.DEBUG:
|
if log.getEffectiveLevel() == logging.DEBUG:
|
||||||
|
Loading…
Reference in New Issue
Block a user