Update server2.py

This commit is contained in:
Namhyeon Go 2022-10-06 11:24:19 +09:00 committed by GitHub
parent 58562c835e
commit 6c5d1d5877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,12 +53,12 @@ def conn_string(conn, data, addr):
url = first_line.split()[1]
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:
temp = url
else:
scheme = url[0:http_pos]
temp = url[(http_pos+3):]
scheme = url[0:http_pos]
port_pos = temp.find(b':')
@ -73,9 +73,11 @@ def conn_string(conn, data, addr):
else:
port = int((temp[(port_pos+1):])[:webserver_pos-port_pos-1])
webserver = temp[:port_pos]
if port == 443:
scheme = b'https'
proxy_server(webserver, port, scheme, conn, addr, data)
except Exception:
except Exception as e:
pass
def proxy_server(webserver, port, scheme, conn, addr, data):