mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Use get_request_line from netlib.http
This commit is contained in:
parent
45d1e5cd0e
commit
ce6147ec35
@ -66,7 +66,9 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
self.sni = connection.get_servername()
|
self.sni = connection.get_servername()
|
||||||
|
|
||||||
def serve_crafted(self, crafted):
|
def serve_crafted(self, crafted):
|
||||||
error, crafted = self.server.check_policy(crafted, self.server.settings)
|
error, crafted = self.server.check_policy(
|
||||||
|
crafted, self.server.settings
|
||||||
|
)
|
||||||
if error:
|
if error:
|
||||||
err = language.make_error_response(error)
|
err = language.make_error_response(error)
|
||||||
language.serve(err, self.wfile, self.server.settings)
|
language.serve(err, self.wfile, self.server.settings)
|
||||||
@ -95,10 +97,8 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
again: True if request handling should continue.
|
again: True if request handling should continue.
|
||||||
log: A dictionary, or None
|
log: A dictionary, or None
|
||||||
"""
|
"""
|
||||||
line = self.rfile.readline()
|
line = http.get_request_line(self.rfile)
|
||||||
if line == "\r\n" or line == "\n": # Possible leftover from previous message
|
if not line:
|
||||||
line = self.rfile.readline()
|
|
||||||
if line == "":
|
|
||||||
# Normal termination
|
# Normal termination
|
||||||
return False, None
|
return False, None
|
||||||
|
|
||||||
@ -113,7 +113,9 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
self.wfile.flush()
|
self.wfile.flush()
|
||||||
if not self.server.ssloptions.not_after_connect:
|
if not self.server.ssloptions.not_after_connect:
|
||||||
try:
|
try:
|
||||||
cert, key, chain_file = self.server.ssloptions.get_cert(m.v[0])
|
cert, key, chain_file = self.server.ssloptions.get_cert(
|
||||||
|
m.v[0]
|
||||||
|
)
|
||||||
self.convert_to_ssl(
|
self.convert_to_ssl(
|
||||||
cert, key,
|
cert, key,
|
||||||
handle_sni=self.handle_sni,
|
handle_sni=self.handle_sni,
|
||||||
|
Loading…
Reference in New Issue
Block a user