Annotation of pkgsrc/lang/python27/patches/patch-Lib_test_test__httplib.py, revision 1.3

1.3     ! leot        1: $NetBSD: patch-Lib_test_test__httplib.py,v 1.2 2020/09/20 12:10:27 mgorny Exp $
1.2       mgorny      2: 
1.3     ! leot        3: bpo-39603 (CVE-2020-26116): header injection via HTTP method
1.2       mgorny      4: 
                      5: taken from:
                      6: https://gitweb.gentoo.org/fork/cpython.git/commit/?h=gentoo-2.7-vanilla&id=138e2caeb4827ccfd1eaff2cf63afb79dfeeb3c4
1.1       mgorny      7: 
                      8: --- Lib/test/test_httplib.py.orig      2020-04-19 21:13:39.000000000 +0000
                      9: +++ Lib/test/test_httplib.py
                     10: @@ -384,6 +384,26 @@ class HeaderTests(TestCase):
                     11:              with self.assertRaisesRegexp(ValueError, 'Invalid header'):
                     12:                  conn.putheader(name, value)
                     13:  
                     14: +    def test_invalid_method_names(self):
                     15: +        methods = (
                     16: +            'GET\r',
                     17: +            'POST\n',
                     18: +            'PUT\n\r',
                     19: +            'POST\nValue',
                     20: +            'POST\nHOST:abc',
                     21: +            'GET\nrHost:abc\n',
                     22: +            'POST\rRemainder:\r',
                     23: +            'GET\rHOST:\n',
                     24: +            '\nPUT'
                     25: +        )
                     26: +
                     27: +        for method in methods:
                     28: +            with self.assertRaisesRegexp(
                     29: +                    ValueError, "method can't contain control characters"):
                     30: +                conn = httplib.HTTPConnection('example.com')
                     31: +                conn.sock = FakeSocket(None)
                     32: +                conn.request(method=method, url="/")
                     33: +
                     34:  
                     35:  class BasicTest(TestCase):
                     36:      def test_status_lines(self):

CVSweb <webmaster@jp.NetBSD.org>