浏览代码

[fix] https issue in request url

version-14
Pratik Vyas 11 年前
committed by Anand Doshi
父节点
当前提交
c3dc7fa0bd
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      webnotes/utils/__init__.py

+ 2
- 2
webnotes/utils/__init__.py 查看文件

@@ -70,7 +70,7 @@ def get_request_site_address(full_address=False):


if not host_name: if not host_name:
if webnotes.request: if webnotes.request:
protocol = 'HTTPS' in webnotes.get_request_header('SERVER_PROTOCOL', "") and 'https://' or 'http://'
protocol = 'https' == webnotes.get_request_header('X-Forwarded-Proto', "") and 'https://' or 'http://'
host_name = protocol + webnotes.request.host host_name = protocol + webnotes.request.host
else: else:
return "http://localhost" return "http://localhost"
@@ -925,4 +925,4 @@ def expand_partial_links(html):
url = get_url() url = get_url()
if not url.endswith("/"): url += "/" if not url.endswith("/"): url += "/"
return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)', return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)',
'\g<1>\g<2>{}\g<3>\g<4>'.format(url), html)
'\g<1>\g<2>{}\g<3>\g<4>'.format(url), html)

正在加载...
取消
保存