Skip to content
Snippets Groups Projects
Commit 228c76db authored by ale's avatar ale
Browse files

Fix bug where internal rpc requests repeated the full URL

Internal POST requests were using a "proxy" HTTP syntax for their
requests, which is incorrect.
parent 11881746
No related branches found
No related tags found
No related merge requests found
Pipeline #40677 passed
...@@ -139,7 +139,8 @@ def _json_request_encoder(req): ...@@ -139,7 +139,8 @@ def _json_request_encoder(req):
def _json_response_decoder(resp): def _json_response_decoder(resp):
if not resp.getheader('Content-Type').startswith('application/json'): content_type = resp.getheader('Content-Type')
if not content_type or not content_type.startswith('application/json'):
raise ValueError('response is not application/json') raise ValueError('response is not application/json')
reader = codecs.getreader('utf-8') reader = codecs.getreader('utf-8')
...@@ -264,12 +265,8 @@ class ClientStub(): ...@@ -264,12 +265,8 @@ class ClientStub():
pass pass
actual_url = urllib3.util.Url( actual_url = urllib3.util.Url(
parsed_url.scheme, path=parsed_url.path,
parsed_url.auth, query=parsed_url.query,
target_addr,
target_port,
parsed_url.path,
parsed_url.query,
) )
resp = pool.urlopen( resp = pool.urlopen(
'POST', 'POST',
......
...@@ -101,6 +101,10 @@ class HTTPWorker(threading.Thread): ...@@ -101,6 +101,10 @@ class HTTPWorker(threading.Thread):
class _Handler(http.server.BaseHTTPRequestHandler): class _Handler(http.server.BaseHTTPRequestHandler):
def do_POST(self): def do_POST(self):
if not self.path.startswith('/'):
self.send_response(400)
self.end_headers()
return
counters.inc(key) counters.inc(key)
with request_counter_lock: with request_counter_lock:
rc = request_counter['value'] rc = request_counter['value']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment