Lines Matching refs:response

388     def check_status_and_reason(self, response, status, data=None):
393 reader = response.fp
394 response.fp = None
396 response._close_conn = close_conn
398 body = response.read()
399 self.assertTrue(response)
400 self.assertEqual(response.status, status)
401 self.assertIsNotNone(response.reason)
406 self.assertEqual(response.version, 10)
407 self.assertEqual(response.msg.get("Connection", "close"), "close")
424 response = self.request(self.base_url + '/')
432 body = self.check_status_and_reason(response, HTTPStatus.OK)
438 response = self.request(self.base_url + '/' + quotedname)
439 self.check_status_and_reason(response, HTTPStatus.OK,
444 response = self.request(self.base_url + '/?x=123').read()
445 self.assertRegex(response, f'listing for {self.base_url}/\?x=123'.encode('latin1'))
447 response = self.request(self.base_url + '/?x=%bb').read()
448 self.assertRegex(response, f'listing for {self.base_url}/\?x=\xef\xbf\xbd'.encode('latin1'))
464 response = self.request(url)
465 self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
466 location = response.getheader('Location')
471 response = self.request(attack_url)
472 self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
473 location = response.getheader('Location')
481 response = self.request(attack3_url)
482 self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
483 self.assertEqual(response.getheader('Location'), expected_location)
491 response = self.request(attack_scheme_netloc_2slash_url)
492 self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
493 location = response.getheader('Location')
501 response = self.request(self.base_url + '/test')
502 self.check_status_and_reason(response, HTTPStatus.OK, data=self.data)
504 response = self.request(self.base_url + '/test/')
505 self.check_status_and_reason(response, HTTPStatus.NOT_FOUND)
506 response = self.request(self.base_url + '/')
507 self.check_status_and_reason(response, HTTPStatus.OK)
508 response = self.request(self.base_url)
509 self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
510 self.assertEqual(response.getheader("Content-Length"), "0")
511 response = self.request(self.base_url + '/?hi=2')
512 self.check_status_and_reason(response, HTTPStatus.OK)
513 response = self.request(self.base_url + '?hi=1')
514 self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
515 self.assertEqual(response.getheader("Location"),
517 response = self.request('/ThisDoesNotExist')
518 self.check_status_and_reason(response, HTTPStatus.NOT_FOUND)
519 response = self.request('/' + 'ThisDoesNotExist' + '/')
520 self.check_status_and_reason(response, HTTPStatus.NOT_FOUND)
522 response = self.request(self.base_url + '/spam/')
523 self.check_status_and_reason(response, HTTPStatus.OK)
528 response = self.request(self.base_url + '/')
529 self.check_status_and_reason(response, HTTPStatus.OK, data)
536 response = self.request(self.base_url + '/')
537 self.check_status_and_reason(response, HTTPStatus.NOT_FOUND)
542 response = self.request(
544 self.check_status_and_reason(response, HTTPStatus.OK)
545 self.assertEqual(response.getheader('content-length'),
547 self.assertEqual(response.getheader('content-type'),
557 response = self.request(self.base_url + '/test', headers=headers)
558 self.check_status_and_reason(response, HTTPStatus.NOT_MODIFIED)
565 response = self.request(self.base_url + '/test', headers=headers)
566 self.check_status_and_reason(response, HTTPStatus.NOT_MODIFIED)
576 response = self.request(self.base_url + '/test', headers=headers)
577 self.check_status_and_reason(response, HTTPStatus.OK)
585 response = self.request(self.base_url + '/test', headers=headers)
586 self.check_status_and_reason(response, HTTPStatus.OK)
589 response = self.request('/', method='FOO')
590 self.check_status_and_reason(response, HTTPStatus.NOT_IMPLEMENTED)
592 response = self.request('/', method='custom')
593 self.check_status_and_reason(response, HTTPStatus.NOT_IMPLEMENTED)
594 response = self.request('/', method='GETs')
595 self.check_status_and_reason(response, HTTPStatus.NOT_IMPLEMENTED)
598 """Checks that the datetime returned in Last-Modified response header
601 response = self.request(self.base_url + '/test')
602 self.check_status_and_reason(response, HTTPStatus.OK, data=self.data)
603 last_modif_header = response.headers['Last-modified']
607 response = self.request(self.tempdir_name + '/test')
608 self.check_status_and_reason(response, HTTPStatus.OK, data=self.data)
609 response = self.request(self.tempdir_name + '/test/')
610 self.check_status_and_reason(response, HTTPStatus.NOT_FOUND)
611 response = self.request(self.tempdir_name + '/')
612 self.check_status_and_reason(response, HTTPStatus.OK)
613 response = self.request(self.tempdir_name)
614 self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
615 response = self.request(self.tempdir_name + '/?hi=2')
616 self.check_status_and_reason(response, HTTPStatus.OK)
617 response = self.request(self.tempdir_name + '?hi=1')
618 self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
619 self.assertEqual(response.getheader("Location"),
633 response = self.request(self.base_url + '/')
634 body = self.check_status_and_reason(response, HTTPStatus.OK)
635 enc = response.headers.get_content_charset()
1021 def verify_http_server_response(self, response):
1022 match = self.HTTPResponseMatch.search(response)