mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-01 07:49:10 +00:00
add comments
This commit is contained in:
parent
a78b185278
commit
21de99cb09
@ -378,6 +378,14 @@ class ProxyHandler(tcp.BaseHandler):
|
|||||||
return self._read_request_absolute_form(client_conn, line)
|
return self._read_request_absolute_form(client_conn, line)
|
||||||
|
|
||||||
def _read_request_authority_form(self, line):
|
def _read_request_authority_form(self, line):
|
||||||
|
"""
|
||||||
|
The authority-form of request-target is only used for CONNECT requests.
|
||||||
|
The CONNECT method is used to request a tunnel to the destination server.
|
||||||
|
This function sends a "200 Connection established" response to the client
|
||||||
|
and returns the host information that can be used to process further requests in origin-form.
|
||||||
|
An example authority-form request line would be:
|
||||||
|
CONNECT www.example.com:80 HTTP/1.1
|
||||||
|
"""
|
||||||
connparts = http.parse_init_connect(line)
|
connparts = http.parse_init_connect(line)
|
||||||
if connparts:
|
if connparts:
|
||||||
self.read_headers(authenticate=True)
|
self.read_headers(authenticate=True)
|
||||||
@ -391,6 +399,12 @@ class ProxyHandler(tcp.BaseHandler):
|
|||||||
return connparts
|
return connparts
|
||||||
|
|
||||||
def _read_request_absolute_form(self, client_conn, line):
|
def _read_request_absolute_form(self, client_conn, line):
|
||||||
|
"""
|
||||||
|
When making a request to a proxy (other than CONNECT or OPTIONS),
|
||||||
|
a client must send the target uri in absolute-form.
|
||||||
|
An example absolute-form request line would be:
|
||||||
|
GET http://www.example.com/foo.html HTTP/1.1
|
||||||
|
"""
|
||||||
r = http.parse_init_proxy(line)
|
r = http.parse_init_proxy(line)
|
||||||
if not r:
|
if not r:
|
||||||
raise ProxyError(400, "Bad HTTP request line: %s"%repr(line))
|
raise ProxyError(400, "Bad HTTP request line: %s"%repr(line))
|
||||||
@ -406,7 +420,10 @@ class ProxyHandler(tcp.BaseHandler):
|
|||||||
|
|
||||||
def _read_request_origin_form(self, client_conn, scheme, host, port):
|
def _read_request_origin_form(self, client_conn, scheme, host, port):
|
||||||
"""
|
"""
|
||||||
Read a HTTP request with regular (origin-form) request line (method, uri, httpversion - RFC2616 5.1).
|
Read a HTTP request with regular (origin-form) request line.
|
||||||
|
An example origin-form request line would be:
|
||||||
|
GET /foo.html HTTP/1.1
|
||||||
|
|
||||||
The request destination is already known from one of the following sources:
|
The request destination is already known from one of the following sources:
|
||||||
1) transparent proxy: destination provided by platform resolver
|
1) transparent proxy: destination provided by platform resolver
|
||||||
2) reverse proxy: fixed destination
|
2) reverse proxy: fixed destination
|
||||||
|
Loading…
Reference in New Issue
Block a user