• Home
  • Raw
  • Download

Lines Matching refs:resp

281         resp = client.HTTPResponse(sock)
282 resp.begin()
284 self.assertEqual(resp.getheader('First'), 'val')
285 self.assertEqual(resp.getheader('Second'), 'val')
301 resp = client.HTTPResponse(sock)
302 resp.begin()
303 self.assertEqual(resp.getheader('Content-Length'), '0')
304 self.assertEqual(resp.msg['Content-Length'], '0')
305 self.assertEqual(resp.getheader("!#$%&'*+-.^_`|~"), 'value')
306 self.assertEqual(resp.msg["!#$%&'*+-.^_`|~"], 'value')
308 self.assertEqual(resp.getheader('VCHAR'), vchar)
309 self.assertEqual(resp.msg['VCHAR'], vchar)
310 self.assertIsNotNone(resp.getheader('obs-text'))
311 self.assertIn('obs-text', resp.msg)
312 for folded in (resp.getheader('obs-fold'), resp.msg['obs-fold']):
354 resp = client.HTTPResponse(sock, debuglevel=1)
356 resp.begin()
497 resp = client.HTTPResponse(sock)
498 resp.begin()
499 self.assertEqual(resp.read(0), b'') # Issue #20007
500 self.assertFalse(resp.isclosed())
501 self.assertFalse(resp.closed)
502 self.assertEqual(resp.read(), b"Text")
503 self.assertTrue(resp.isclosed())
504 self.assertFalse(resp.closed)
505 resp.close()
506 self.assertTrue(resp.closed)
510 resp = client.HTTPResponse(sock)
511 self.assertRaises(client.BadStatusLine, resp.begin)
522 resp = client.HTTPResponse(sock)
523 resp.begin()
524 self.assertEqual(resp.read(2), b'Te')
525 self.assertFalse(resp.isclosed())
526 self.assertEqual(resp.read(2), b'xt')
527 self.assertTrue(resp.isclosed())
528 self.assertFalse(resp.closed)
529 resp.close()
530 self.assertTrue(resp.closed)
537 resp = client.HTTPResponse(sock)
538 resp.begin()
539 self.assertEqual(resp.readline(), b'Text\r\n')
540 self.assertFalse(resp.isclosed())
541 self.assertEqual(resp.read(), b'Another')
542 self.assertTrue(resp.isclosed())
543 self.assertFalse(resp.closed)
544 resp.close()
545 self.assertTrue(resp.closed)
552 resp = client.HTTPResponse(sock)
553 resp.begin()
555 n = resp.readinto(b)
558 self.assertFalse(resp.isclosed())
559 n = resp.readinto(b)
562 self.assertTrue(resp.isclosed())
563 self.assertFalse(resp.closed)
564 resp.close()
565 self.assertTrue(resp.closed)
572 resp = client.HTTPResponse(sock)
573 resp.begin()
574 self.assertEqual(resp.read(2), b'Te')
575 self.assertFalse(resp.isclosed())
576 self.assertEqual(resp.read(2), b'xt')
577 self.assertEqual(resp.read(1), b'')
578 self.assertTrue(resp.isclosed())
579 self.assertFalse(resp.closed)
580 resp.close()
581 self.assertTrue(resp.closed)
588 resp = client.HTTPResponse(sock)
589 resp.begin()
591 n = resp.readinto(b)
594 self.assertFalse(resp.isclosed())
595 n = resp.readinto(b)
598 n = resp.readinto(b)
600 self.assertTrue(resp.isclosed())
607 resp = client.HTTPResponse(sock)
608 resp.begin()
609 self.assertEqual(resp.read(2), b'Te')
610 self.assertFalse(resp.isclosed())
611 self.assertEqual(resp.read(2), b'xt')
612 self.assertEqual(resp.read(1), b'')
613 self.assertTrue(resp.isclosed())
620 resp = client.HTTPResponse(sock)
621 resp.begin()
623 n = resp.readinto(b)
626 self.assertFalse(resp.isclosed())
627 n = resp.readinto(b)
630 n = resp.readinto(b)
632 self.assertTrue(resp.isclosed())
633 self.assertFalse(resp.closed)
634 resp.close()
635 self.assertTrue(resp.closed)
680 resp = client.HTTPResponse(sock, method="HEAD")
681 resp.begin()
682 if resp.read():
693 resp = client.HTTPResponse(sock, method="HEAD")
694 resp.begin()
696 if resp.readinto(b) != 0:
807 resp = client.HTTPResponse(sock, method="GET")
808 resp.begin()
809 self.assertEqual(resp.read(), expected)
810 resp.close()
815 resp = client.HTTPResponse(sock, method="GET")
816 resp.begin()
817 self.assertEqual(resp.read(n) + resp.read(n) + resp.read(), expected)
818 resp.close()
822 resp = client.HTTPResponse(sock, method="GET")
823 resp.begin()
825 resp.read()
834 resp.close()
843 resp = client.HTTPResponse(sock, method="GET")
844 resp.begin()
845 n = resp.readinto(b)
848 resp.close()
853 resp = client.HTTPResponse(sock, method="GET")
854 resp.begin()
856 i = resp.readinto(m[0:n])
857 i += resp.readinto(m[i:n + i])
858 i += resp.readinto(m[i:])
861 resp.close()
865 resp = client.HTTPResponse(sock, method="GET")
866 resp.begin()
868 n = resp.readinto(b)
877 resp.close()
889 resp = client.HTTPResponse(sock, method="HEAD")
890 resp.begin()
891 self.assertEqual(resp.read(), b'')
892 self.assertEqual(resp.status, 200)
893 self.assertEqual(resp.reason, 'OK')
894 self.assertTrue(resp.isclosed())
895 self.assertFalse(resp.closed)
896 resp.close()
897 self.assertTrue(resp.closed)
909 resp = client.HTTPResponse(sock, method="HEAD")
910 resp.begin()
912 n = resp.readinto(b)
915 self.assertEqual(resp.status, 200)
916 self.assertEqual(resp.reason, 'OK')
917 self.assertTrue(resp.isclosed())
918 self.assertFalse(resp.closed)
919 resp.close()
920 self.assertTrue(resp.closed)
925 resp = client.HTTPResponse(sock, method="GET")
926 resp.begin()
927 self.assertEqual(resp.read(), b'Hello\r\n')
928 self.assertTrue(resp.isclosed())
932 resp = client.HTTPResponse(sock, method="GET")
933 resp.begin()
935 resp.read()
942 self.assertTrue(resp.isclosed())
956 resp = conn.getresponse()
957 self.assertEqual(401, resp.status)
959 resp.getheader("www-authenticate"))
965 resp = client.HTTPResponse(FakeSocket(body))
966 self.assertRaises((client.LineTooLong, client.BadStatusLine), resp.begin)
973 resp = client.HTTPResponse(FakeSocket(body))
974 self.assertRaises(client.LineTooLong, resp.begin)
985 resp = client.HTTPResponse(FakeSocket(body))
986 resp.begin()
987 self.assertRaises(client.LineTooLong, resp.read)
993 resp = client.HTTPResponse(sock)
994 resp.begin()
995 self.assertEqual(resp.read(), b'')
996 self.assertTrue(resp.isclosed())
997 self.assertFalse(resp.closed)
998 resp.close()
999 self.assertTrue(resp.closed)
1022 resp = client.HTTPResponse(sock, method="GET")
1023 resp.begin()
1024 self.assertEqual(resp.read(), expected)
1025 resp.close()
1031 resp = client.HTTPResponse(sock, method="GET")
1032 resp.begin()
1033 self.assertEqual(resp.read(), expected)
1034 resp.close()
1040 resp = client.HTTPResponse(sock, method="GET")
1041 resp.begin()
1042 self.assertEqual(resp.read(), expected)
1045 resp.close()
1052 resp = client.HTTPResponse(sock, method="GET")
1053 resp.begin()
1054 self.assertEqual(resp.read(), expected)
1057 resp.close()
1064 resp = client.HTTPResponse(sock, method="GET")
1065 resp.begin()
1066 self.assertEqual(resp.read(), expected)
1069 resp.close()
1075 resp = client.HTTPResponse(sock, method="GET")
1076 resp.begin()
1077 self.assertEqual(resp.readlines(2000), [expected])
1080 resp.close()
1086 resp = client.HTTPResponse(sock, method="GET")
1087 resp.begin()
1088 self.assertEqual(resp.read1(2000), expected)
1091 resp.close()
1097 resp = client.HTTPResponse(sock, method="GET")
1098 resp.begin()
1099 self.assertEqual(resp.readline(10), expected)
1100 self.assertEqual(resp.readline(10), b"")
1103 resp.close()
1109 resp = client.HTTPResponse(sock, method="GET")
1110 resp.begin()
1111 self.assertEqual(resp.read1(20), expected*2)
1112 self.assertEqual(resp.read(), expected)
1115 resp.close()
1189 resp = client.HTTPResponse(sock, method="GET")
1190 resp.begin()
1191 resp.fp = io.BufferedReader(resp.fp)
1192 self.resp = resp
1197 resp = self.resp
1199 oldpeek = resp.fp.peek
1205 resp.fp.peek = mypeek
1210 p = resp.peek(3)
1214 p2 = resp.peek()
1217 next = resp.read(len(p2))
1220 next = resp.read()
1228 resp = self.resp
1229 self._verify_readline(self.resp.readline, self.lines_expected)
1245 resp = self.resp
1247 res = resp.read1(4)
1254 resp = self.resp
1257 data = resp.read1()
1264 resp = self.resp
1267 data = resp.read1(10)
1275 self.assertEqual(self.resp.read1(0), b"")
1278 p = self.resp.peek(0)
1601 resp = h.getresponse()
1603 self.assertIn('nginx', resp.getheader('server'))
1604 resp.close()
1613 resp = h.getresponse()
1614 content_type = resp.getheader('content-type')
1615 resp.close()
1630 resp = h.getresponse()
1631 server_string = resp.getheader('server')
1632 resp.close()
1666 resp = h.getresponse()
1667 self.addCleanup(resp.close)
1668 self.assertEqual(resp.status, 404)
1691 resp = h.getresponse()
1692 resp.close()
1694 self.assertEqual(resp.status, 404)
1700 resp = h.getresponse()
1701 self.assertEqual(resp.status, 404)
1702 resp.close()
1835 self.resp = client.HTTPResponse(sock)
1836 self.resp.begin()
1839 header = self.resp.getheader('My-Header')
1842 header = self.resp.getheader('My-Header', 'some default')
1846 header = self.resp.getheader('No-Such-Header', 'default-value')
1850 header = self.resp.getheader('No-Such-Header', ['default', 'values'])
1853 header = self.resp.getheader('No-Such-Header', ('default', 'values'))
1857 header = self.resp.getheader('No-Such-Header')
1861 header = self.resp.getheader('No-Such-Header',default=42)