mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-06 01:41:00 +00:00
Update server2.py
This commit is contained in:
parent
58562c835e
commit
6c5d1d5877
|
@ -53,12 +53,12 @@ def conn_string(conn, data, addr):
|
||||||
url = first_line.split()[1]
|
url = first_line.split()[1]
|
||||||
|
|
||||||
http_pos = url.find(b'://') #Finding the position of ://
|
http_pos = url.find(b'://') #Finding the position of ://
|
||||||
scheme = "http" # check http/https or other protocol
|
scheme = b'http' # check http/https or other protocol
|
||||||
if http_pos == -1:
|
if http_pos == -1:
|
||||||
temp = url
|
temp = url
|
||||||
else:
|
else:
|
||||||
scheme = url[0:http_pos]
|
|
||||||
temp = url[(http_pos+3):]
|
temp = url[(http_pos+3):]
|
||||||
|
scheme = url[0:http_pos]
|
||||||
|
|
||||||
port_pos = temp.find(b':')
|
port_pos = temp.find(b':')
|
||||||
|
|
||||||
|
@ -73,9 +73,11 @@ def conn_string(conn, data, addr):
|
||||||
else:
|
else:
|
||||||
port = int((temp[(port_pos+1):])[:webserver_pos-port_pos-1])
|
port = int((temp[(port_pos+1):])[:webserver_pos-port_pos-1])
|
||||||
webserver = temp[:port_pos]
|
webserver = temp[:port_pos]
|
||||||
|
if port == 443:
|
||||||
|
scheme = b'https'
|
||||||
|
|
||||||
proxy_server(webserver, port, scheme, conn, addr, data)
|
proxy_server(webserver, port, scheme, conn, addr, data)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def proxy_server(webserver, port, scheme, conn, addr, data):
|
def proxy_server(webserver, port, scheme, conn, addr, data):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user