mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
adjust to new netlib headers
This commit is contained in:
parent
a10acda80b
commit
b889e9e1a2
@ -197,10 +197,10 @@ class Response(_HTTPMessage):
|
|||||||
1,
|
1,
|
||||||
Code(101)
|
Code(101)
|
||||||
)
|
)
|
||||||
hdrs = netlib.websockets.WebsocketsProtocol.server_handshake_headers(
|
headers = netlib.websockets.WebsocketsProtocol.server_handshake_headers(
|
||||||
settings.websocket_key
|
settings.websocket_key
|
||||||
)
|
)
|
||||||
for i in hdrs.lst:
|
for i in headers.fields:
|
||||||
if not get_header(i[0], self.headers):
|
if not get_header(i[0], self.headers):
|
||||||
tokens.append(
|
tokens.append(
|
||||||
Header(
|
Header(
|
||||||
@ -309,7 +309,7 @@ class Request(_HTTPMessage):
|
|||||||
1,
|
1,
|
||||||
Method("get")
|
Method("get")
|
||||||
)
|
)
|
||||||
for i in netlib.websockets.WebsocketsProtocol.client_handshake_headers().lst:
|
for i in netlib.websockets.WebsocketsProtocol.client_handshake_headers().fields:
|
||||||
if not get_header(i[0], self.headers):
|
if not get_header(i[0], self.headers):
|
||||||
tokens.append(
|
tokens.append(
|
||||||
Header(
|
Header(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import pyparsing as pp
|
import pyparsing as pp
|
||||||
|
|
||||||
from netlib import odict
|
from netlib.http import user_agents, semantics, Headers
|
||||||
from netlib.http import user_agents, semantics
|
|
||||||
from . import base, message
|
from . import base, message
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -179,7 +178,7 @@ class Response(_HTTP2Message):
|
|||||||
if self.rendered_values:
|
if self.rendered_values:
|
||||||
return self.rendered_values
|
return self.rendered_values
|
||||||
else:
|
else:
|
||||||
headers = odict.ODictCaseless([header.values(settings) for header in self.headers])
|
headers = Headers([header.values(settings) for header in self.headers])
|
||||||
|
|
||||||
body = self.body
|
body = self.body
|
||||||
if body:
|
if body:
|
||||||
@ -262,7 +261,7 @@ class Request(_HTTP2Message):
|
|||||||
if self.nested_response:
|
if self.nested_response:
|
||||||
path += self.nested_response.parsed.spec()
|
path += self.nested_response.parsed.spec()
|
||||||
|
|
||||||
headers = odict.ODictCaseless([header.values(settings) for header in self.headers])
|
headers = Headers([header.values(settings) for header in self.headers])
|
||||||
|
|
||||||
body = self.body
|
body = self.body
|
||||||
if body:
|
if body:
|
||||||
|
@ -4,9 +4,8 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import urllib
|
import urllib
|
||||||
import time
|
|
||||||
|
|
||||||
from netlib import tcp, http, wsgi, certutils, websockets, odict
|
from netlib import tcp, http, certutils, websockets
|
||||||
from netlib.http import http1, http2
|
from netlib.http import http1, http2
|
||||||
|
|
||||||
from . import version, app, language, utils, log, protocols
|
from . import version, app, language, utils, log, protocols
|
||||||
@ -160,7 +159,7 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
request=dict(
|
request=dict(
|
||||||
path=path,
|
path=path,
|
||||||
method=method,
|
method=method,
|
||||||
headers=headers.lst,
|
headers=headers.fields,
|
||||||
httpversion=httpversion,
|
httpversion=httpversion,
|
||||||
sni=self.sni,
|
sni=self.sni,
|
||||||
remote_address=self.address(),
|
remote_address=self.address(),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from netlib import tcp, http, wsgi, certutils, websockets, odict
|
from netlib import tcp, http, wsgi, certutils, websockets
|
||||||
from .. import version, app, language, utils, log
|
from .. import version, app, language, utils, log
|
||||||
|
|
||||||
class WebsocketsProtocol:
|
class WebsocketsProtocol:
|
||||||
|
Loading…
Reference in New Issue
Block a user