From 8375c4474c430d9bdd833f84bb69699ff2f99cf8 Mon Sep 17 00:00:00 2001 From: Gagan Deep Date: Fri, 17 Jun 2022 15:47:38 +0530 Subject: [PATCH] [fix] Fixed uwsgi_curl It was not possible to use uwsgi_curl for URLs, e.g.: http://127.0.0.1:8000/admin --- images/common/utils.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/images/common/utils.py b/images/common/utils.py index 958c84e0..2e557d6d 100644 --- a/images/common/utils.py +++ b/images/common/utils.py @@ -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: @@ -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