Skip to content

Commit

Permalink
[fix] Fixed uwsgi_curl
Browse files Browse the repository at this point in the history
It was not possible to use uwsgi_curl for URLs, e.g.:
http://127.0.0.1:8000/admin
  • Loading branch information
pandafy committed Jun 17, 2022
1 parent fa5c539 commit 8375c44
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions images/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,8 @@ def ask_uwsgi(uwsgi_addr, var, body='', timeout=0, udp=False):
return b''.join(response).decode('utf8')


def uwsgi_curl(
uwsgi_addr, url='localhost', method='GET', body='', timeout=0, headers=(), udp=False
):
host, uri = get_host_from_url(url)
def uwsgi_curl(uwsgi_addr, method='GET', body='', timeout=0, headers=(), udp=False):
host, uri = get_host_from_url(uwsgi_addr)
parts_uri = urlsplit(uri)

if '/' not in uwsgi_addr:
Expand All @@ -145,7 +143,6 @@ def uwsgi_curl(
var['SERVER_NAME'] = var['HTTP_HOST']
if port:
var['SERVER_PORT'] = str(port)
result = ask_uwsgi(
uwsgi_addr=uwsgi_addr, var=var, body=body, timeout=timeout, udp=udp
)

result = ask_uwsgi(uwsgi_addr=host, var=var, body=body, timeout=timeout, udp=udp)
return result

0 comments on commit 8375c44

Please sign in to comment.