mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-06 01:41:00 +00:00
Update server.py
This commit is contained in:
parent
99244de542
commit
cfb7866cd6
|
@ -29,6 +29,7 @@ from platform import python_version
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
from requests.auth import HTTPBasicAuth
|
from requests.auth import HTTPBasicAuth
|
||||||
|
from urllib.parse import urlparse
|
||||||
from decouple import config
|
from decouple import config
|
||||||
|
|
||||||
def extract_credentials(url):
|
def extract_credentials(url):
|
||||||
|
@ -120,7 +121,8 @@ def conn_string(conn, data, addr):
|
||||||
webserver, port, scheme, method, url = parse_first_data(data)
|
webserver, port, scheme, method, url = parse_first_data(data)
|
||||||
|
|
||||||
# JSON-RPC 2.0 request over HTTP
|
# JSON-RPC 2.0 request over HTTP
|
||||||
if url.decode(client_encoding).endswith("/proxy-cgi/jsonrpc2"):
|
path = urlparse(url.decode(client_encoding)).path
|
||||||
|
if path == "/proxy-cgi/jsonrpc2":
|
||||||
conn.send(b'HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n')
|
conn.send(b'HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n')
|
||||||
pos = data.find(b'\r\n\r\n')
|
pos = data.find(b'\r\n\r\n')
|
||||||
if pos > -1 and process_jsonrpc2(data[pos+4:]):
|
if pos > -1 and process_jsonrpc2(data[pos+4:]):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user