| 933 | "\r\n")) |
| 934 | |
| 935 | def open_connection(self, host=None) -> socket: |
| 936 | if self._proxies: |
| 937 | sock = randchoice(self._proxies).open_socket(AF_INET, SOCK_STREAM) |
| 938 | else: |
| 939 | sock = socket(AF_INET, SOCK_STREAM) |
| 940 | |
| 941 | sock.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) |
| 942 | sock.settimeout(.9) |
| 943 | sock.connect(host or self._raw_target) |
| 944 | |
| 945 | if self._target.scheme.lower() == "https": |
| 946 | sock = ctx.wrap_socket(sock, |
| 947 | server_hostname=host[0] if host else self._target.host, |
| 948 | server_side=False, |
| 949 | do_handshake_on_connect=True, |
| 950 | suppress_ragged_eofs=True) |
| 951 | return sock |
| 952 | |
| 953 | @property |
| 954 | def randHeadercontent(self) -> str: |