Esempio n. 1
0
    def _is_extended_connect_frame(self, frame):
        if not isinstance(frame, RequestReceived):
            return False

        method = extract_method_header(frame.headers)
        if method != b"CONNECT":
            return False

        protocol = ""
        for key, value in frame.headers:
            if key in (b':protocol', u':protocol'):
                protocol = isomorphic_encode(value)
                break
        if protocol != b"websocket":
            raise ProtocolError("Invalid protocol %s with CONNECT METHOD" % (protocol,))

        return True
 def test_extract_header_method(self):
     assert extract_method_header(self.example_request_headers) \
              == b'GET'
Esempio n. 3
0
 def test_extract_header_method(self, headers):
     assert extract_method_header(headers) == b'GET'
Esempio n. 4
0
 def test_extract_header_method(self, headers):
     assert extract_method_header(headers) == b'GET'