Lines Matching refs:resp
238 resp = httplib.HTTPResponse(sock)
239 resp.begin()
241 self.assertEqual(resp.getheader('First'), 'val')
242 self.assertEqual(resp.getheader('Second'), 'val')
247 resp = (
256 resp = httplib.HTTPResponse(FakeSocket(resp))
257 resp.begin()
258 self.assertIsNotNone(resp.getheader('Public-Key-Pins'))
259 self.assertEqual(resp.getheader('Transfer-Encoding'), 'chunked')
260 self.assertEqual(resp.read(), b'body')
266 resp = b'HTTP/1.1 200 OK\r\n' b'Transfer-Encoding: chunked\r\n'
267 resp += blank
268 resp += b'4\r\nbody\r\n0\r\n\r\n'
269 resp = httplib.HTTPResponse(FakeSocket(resp))
270 resp.begin()
271 self.assertEqual(resp.getheader('Transfer-Encoding'), 'chunked')
272 self.assertEqual(resp.read(), b'body')
274 resp = b'HTTP/1.0 200 OK\r\n' + blank + b'body'
275 resp = httplib.HTTPResponse(FakeSocket(resp))
276 resp.begin()
277 self.assertEqual(resp.read(), b'body')
282 resp = (
290 resp = httplib.HTTPResponse(FakeSocket(resp))
291 resp.begin()
292 self.assertEqual(resp.getheader('Transfer-Encoding'), 'chunked')
293 self.assertEqual(resp.read(), b'body')
296 resp = b'HTTP/1.0 200 OK\r\n'
297 resp = httplib.HTTPResponse(FakeSocket(resp))
298 resp.begin()
299 self.assertEqual(resp.read(), b'')
304 resp = (
316 resp = httplib.HTTPResponse(FakeSocket(resp))
317 resp.begin()
318 self.assertIsNotNone(resp.getheader('Name'))
319 self.assertEqual(resp.getheader('Transfer-Encoding'), 'chunked')
320 self.assertEqual(resp.read(), b'body')
322 resp = (
328 resp = httplib.HTTPResponse(FakeSocket(resp))
329 resp.begin()
330 self.assertEqual(resp.read(), b'body')
346 resp = httplib.HTTPResponse(sock)
347 resp.begin()
348 self.assertEqual(resp.getheader('Content-Length'), '0')
349 self.assertEqual(resp.getheader("!#$%&'*+-.^_`|~"), 'value')
351 self.assertEqual(resp.getheader('VCHAR'), vchar)
352 self.assertIsNotNone(resp.getheader('obs-text'))
353 folded = resp.getheader('obs-fold')
394 resp = httplib.HTTPResponse(sock)
395 resp.begin()
396 self.assertEqual(resp.read(0), '') # Issue #20007
397 self.assertFalse(resp.isclosed())
398 self.assertEqual(resp.read(), 'Text')
399 self.assertTrue(resp.isclosed())
403 resp = httplib.HTTPResponse(sock)
404 self.assertRaises(httplib.BadStatusLine, resp.begin)
415 resp = httplib.HTTPResponse(sock)
416 resp.begin()
417 self.assertEqual(resp.read(2), 'Te')
418 self.assertFalse(resp.isclosed())
419 self.assertEqual(resp.read(2), 'xt')
420 self.assertTrue(resp.isclosed())
427 resp = httplib.HTTPResponse(sock)
428 resp.begin()
429 self.assertEqual(resp.read(2), 'Te')
430 self.assertFalse(resp.isclosed())
431 self.assertEqual(resp.read(2), 'xt')
432 self.assertEqual(resp.read(1), '')
433 self.assertTrue(resp.isclosed())
440 resp = httplib.HTTPResponse(sock)
441 resp.begin()
442 self.assertEqual(resp.read(2), 'Te')
443 self.assertFalse(resp.isclosed())
444 self.assertEqual(resp.read(2), 'xt')
445 self.assertEqual(resp.read(1), '')
446 self.assertTrue(resp.isclosed())
495 resp = httplib.HTTPResponse(sock, method="HEAD")
496 resp.begin()
497 if resp.read() != "":
558 resp = httplib.HTTPResponse(sock, method="GET")
559 resp.begin()
560 self.assertEqual(resp.read(), 'hello world')
561 resp.close()
565 resp = httplib.HTTPResponse(sock, method="GET")
566 resp.begin()
568 resp.read()
576 resp.close()
588 resp = httplib.HTTPResponse(sock, method="HEAD")
589 resp.begin()
590 self.assertEqual(resp.read(), '')
591 self.assertEqual(resp.status, 200)
592 self.assertEqual(resp.reason, 'OK')
593 self.assertTrue(resp.isclosed())
598 resp = httplib.HTTPResponse(sock, method="GET")
599 resp.begin()
600 self.assertEqual(resp.read(), 'Hello\r\n')
601 self.assertTrue(resp.isclosed())
605 resp = httplib.HTTPResponse(sock, method="GET")
606 resp.begin()
608 resp.read()
615 self.assertTrue(resp.isclosed())
629 resp = conn.getresponse()
630 self.assertEqual(401, resp.status)
632 resp.getheader("www-authenticate"))
638 resp = httplib.HTTPResponse(sock)
639 self.assertTrue(hasattr(resp,'fileno'),
647 resp = httplib.HTTPResponse(FakeSocket(body))
648 self.assertRaises((httplib.LineTooLong, httplib.BadStatusLine), resp.begin)
655 resp = httplib.HTTPResponse(FakeSocket(body))
656 self.assertRaises(httplib.LineTooLong, resp.begin)
666 resp = httplib.HTTPResponse(FakeSocket(body))
667 resp.begin()
668 self.assertRaises(httplib.LineTooLong, resp.read)
674 resp = httplib.HTTPResponse(sock)
675 resp.begin()
676 self.assertEqual(resp.read(), '')
677 self.assertTrue(resp.isclosed())
844 resp = h.getresponse()
845 self.assertIn('nginx', resp.getheader('server'))
854 resp = h.getresponse()
855 content_type = resp.getheader('content-type')
868 resp = h.getresponse()
869 server_string = resp.getheader('server')
903 resp = h.getresponse()
904 self.assertEqual(resp.status, 404)
922 resp = h.getresponse()
923 self.assertEqual(resp.status, 404)