mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Fix an issue caused by some editors when editing a request/response body.
Many editors make it hard save a file without a terminating newline on the last line. When editing message bodies, this can cause problems. For now, I just strip the newlines off the end of the body when we return from an editor.
This commit is contained in:
parent
2a09cad420
commit
d5e3722c97
@ -454,7 +454,8 @@ class ConnectionView(WWrap):
|
||||
|
||||
self.flow.backup()
|
||||
if part == "b":
|
||||
conn.content = self._spawn_editor(conn.content or "")
|
||||
c = self._spawn_editor(conn.content or "")
|
||||
conn.content = c.rstrip("\n")
|
||||
elif part == "h":
|
||||
headertext = self._spawn_editor(repr(conn.headers))
|
||||
headers = flow.Headers()
|
||||
|
@ -437,6 +437,3 @@ def parse_size(s):
|
||||
return int(s) * mult
|
||||
except ValueError:
|
||||
raise ValueError("Invalid size specification: %s"%s)
|
||||
|
||||
|
||||
|
||||
|
@ -4,7 +4,5 @@ from BaseHTTPServer import HTTPServer
|
||||
import handler
|
||||
|
||||
def make(port):
|
||||
server_address = ('', port)
|
||||
server_address = ('127.0.0.1', port)
|
||||
return HTTPServer(server_address, handler.TestRequestHandler)
|
||||
|
||||
|
||||
|
@ -18,5 +18,5 @@ class SecureHTTPServer(HTTPServer):
|
||||
|
||||
|
||||
def make(port):
|
||||
server_address = ('', port)
|
||||
server_address = ('127.0.0.1', port)
|
||||
return SecureHTTPServer(server_address, handler.TestRequestHandler)
|
||||
|
Loading…
Reference in New Issue
Block a user