| 893 | self.assertStatus(200) |
| 894 | |
| 895 | def test_CONNECT_method(self): |
| 896 | self.persistent = True |
| 897 | try: |
| 898 | conn = self.HTTP_CONN |
| 899 | conn.request('CONNECT', 'created.example.com:3128') |
| 900 | response = conn.response_class(conn.sock, method='CONNECT') |
| 901 | response.begin() |
| 902 | self.assertEqual(response.status, 204) |
| 903 | finally: |
| 904 | self.persistent = False |
| 905 | |
| 906 | self.persistent = True |
| 907 | try: |
| 908 | conn = self.HTTP_CONN |
| 909 | conn.request('CONNECT', 'body.example.com:3128') |
| 910 | response = conn.response_class(conn.sock, method='CONNECT') |
| 911 | response.begin() |
| 912 | self.assertEqual(response.status, 200) |
| 913 | self.body = response.read() |
| 914 | self.assertBody(b'CONNECTed to /body.example.com:3128') |
| 915 | finally: |
| 916 | self.persistent = False |
| 917 | |
| 918 | def test_CONNECT_method_invalid_authority(self): |
| 919 | for request_target in ['example.com', 'http://example.com:33', |