More detailed info on http host error
This commit is contained in:
parent
113b57415f
commit
d36324e0d3
1 changed files with 10 additions and 3 deletions
|
@ -112,8 +112,14 @@ class UiRequest(object):
|
||||||
self_host = self.env["HTTP_HOST"].split(":")[0]
|
self_host = self.env["HTTP_HOST"].split(":")[0]
|
||||||
self_ip = self.env["HTTP_HOST"].replace(self_host, socket.gethostbyname(self_host))
|
self_ip = self.env["HTTP_HOST"].replace(self_host, socket.gethostbyname(self_host))
|
||||||
link = "http://{0}{1}".format(self_ip, http_get)
|
link = "http://{0}{1}".format(self_ip, http_get)
|
||||||
ret_link = """<h4>Access via ip: <a href="{0}">{0}</a>""".format(html.escape(link)).encode("utf8")
|
ret_body = """
|
||||||
return iter([ret_error, ret_link])
|
<h4>Start the client with <code>--ui_host "{host}"</code> argument</h4>
|
||||||
|
<h4>or access via ip: <a href="{link}">{link}</a></h4>
|
||||||
|
""".format(
|
||||||
|
host=html.escape(self.env["HTTP_HOST"]),
|
||||||
|
link=html.escape(link)
|
||||||
|
).encode("utf8")
|
||||||
|
return iter([ret_error, ret_body])
|
||||||
|
|
||||||
# Prepend .bit host for transparent proxy
|
# Prepend .bit host for transparent proxy
|
||||||
if self.isDomain(self.env.get("HTTP_HOST")):
|
if self.isDomain(self.env.get("HTTP_HOST")):
|
||||||
|
@ -907,7 +913,8 @@ class UiRequest(object):
|
||||||
else:
|
else:
|
||||||
return """
|
return """
|
||||||
<style>
|
<style>
|
||||||
* { font-family: Consolas, Monospace; color: #333; font-size: 100%%; }
|
* { font-family: Consolas, Monospace; color: #333; }
|
||||||
|
code { font-family: Consolas, Monospace; background-color: #EEE }
|
||||||
</style>
|
</style>
|
||||||
<h1>%s</h1>
|
<h1>%s</h1>
|
||||||
<h2>%s</h3>
|
<h2>%s</h3>
|
||||||
|
|
Loading…
Reference in a new issue