mirror of https://github.com/zulip/zulip.git
Annotate tools/run-dev.py.
This commit is contained in:
parent
cc11229377
commit
89267f926e
|
@ -8,6 +8,8 @@ import traceback
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
if False: from typing import Any
|
||||||
|
|
||||||
# find out python version
|
# find out python version
|
||||||
major_version = int(subprocess.check_output(['python', '-c', 'import sys; print(sys.version_info[0])']))
|
major_version = int(subprocess.check_output(['python', '-c', 'import sys; print(sys.version_info[0])']))
|
||||||
if major_version != 2:
|
if major_version != 2:
|
||||||
|
@ -27,6 +29,7 @@ from twisted.web import proxy, server, resource
|
||||||
from twisted.web.http import Request
|
from twisted.web.http import Request
|
||||||
orig_finish = Request.finish
|
orig_finish = Request.finish
|
||||||
def patched_finish(self):
|
def patched_finish(self):
|
||||||
|
# type: (Any) -> None
|
||||||
if not self._disconnected:
|
if not self._disconnected:
|
||||||
orig_finish(self)
|
orig_finish(self)
|
||||||
Request.finish = patched_finish
|
Request.finish = patched_finish
|
||||||
|
@ -115,6 +118,8 @@ for cmd in cmds:
|
||||||
|
|
||||||
class Resource(resource.Resource):
|
class Resource(resource.Resource):
|
||||||
def getChild(self, name, request):
|
def getChild(self, name, request):
|
||||||
|
# type: (str, server.Request) -> resource.Resource
|
||||||
|
|
||||||
# Assume an HTTP 1.1 request
|
# Assume an HTTP 1.1 request
|
||||||
proxy_host = request.requestHeaders.getRawHeaders('Host')
|
proxy_host = request.requestHeaders.getRawHeaders('Host')
|
||||||
request.requestHeaders.setRawHeaders('X-Forwarded-Host', proxy_host)
|
request.requestHeaders.setRawHeaders('X-Forwarded-Host', proxy_host)
|
||||||
|
|
Loading…
Reference in New Issue