Skip to content

Commit

Permalink
fix API server host to localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
RainbowUnicorn7297 committed Jun 8, 2022
1 parent b2306c8 commit 118aa04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion prototype/build.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyinstaller --clean -F main.spec
pyinstaller --clean main.spec
6 changes: 4 additions & 2 deletions prototype/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
from ssl import SSLContext, PROTOCOL_TLS_SERVER
from os import path
import sys, requests
import urllib3

port = 443
api_port = 8443

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

class ProxyHTTPRequestHandler(BaseHTTPRequestHandler):
protocol_version = 'HTTP/1.1'
close_connection = True

def do_POST(self):
host = self.headers.get('Host')
host = host.split(':')[0] + ':' + str(api_port)
host = 'localhost:' + str(api_port)
url = f'https://{host}{self.path}'
content_len = int(self.headers.get('Content-Length'))
req_body = self.rfile.read(content_len)
Expand Down

0 comments on commit 118aa04

Please sign in to comment.