Lines Matching +full:basic +full:- +full:ftp
71 However, .headers pre-dates those methods, and so real code will be using
75 code that previously saw all (urllib2 user)-provided headers in .headers
86 >>> Request(url, headers={"Spam-eggs": "blah"}).headers["Spam-eggs"]
88 >>> Request(url, headers={"spam-EggS": "blah"}).headers["Spam-eggs"]
91 Currently, Request(url, "Spam-eggs").headers["Spam-Eggs"] raises KeyError,
98 Note the case normalization of header names here, to .capitalize()-case.
99 This should be preserved for backwards-compatibility. (In the HTTP case,
100 normalization to .title()-case is done by urllib2 before sending headers to
104 >>> r = Request(url, headers={"Spam-eggs": "blah"})
105 >>> r.has_header("Spam-eggs")
108 [('Spam-eggs', 'blah')]
109 >>> r.add_header("Foo-Bar", "baz")
113 [('Foo-bar', 'baz'), ('Spam-eggs', 'blah')]
115 Note that e.g. r.has_header("spam-EggS") is currently False, and
116 r.get_header("spam-EggS") returns None, but that could be changed in
119 >>> r.has_header("Not-there")
121 >>> print r.get_header("Not-there")
123 >>> r.get_header("Not-there", "default")
160 ## Currently, we use the highest-level path where more than one match:
438 # Useful for testing the Proxy-Authorization request by verifying the
469 # test work-around for three methods that accidentally follow the
473 # These used to call the accidentally-named methods, causing a
490 # handler returning non-None means no more handlers will be called
503 # non-None. Handlers without .http_open() never get any methods called
647 ("ftp://localhost/foo/bar/baz.html",
650 ("ftp://parrot@localhost/foo/bar/baz.html",
653 ("ftp://%25parrot@localhost/foo/bar/baz.html",
656 ("ftp://%2542parrot@localhost/foo/bar/baz.html",
659 ("ftp://localhost:80/foo/bar/",
662 ("ftp://localhost/baz.gif;type=a",
669 # ftp authentication not yet implemented by FTPHandler
678 self.assertEqual(headers.get("Content-type"), mimetype)
679 self.assertEqual(int(headers["Content-length"]), len(data))
721 self.assertEqual(headers["Content-type"], "text/plain")
722 self.assertEqual(headers["Content-length"], "13")
723 self.assertEqual(headers["Last-modified"], modified)
748 # XXXX why does // mean ftp (and /// mean not ftp!), and where
754 # file://ftp.example.com/blah.txt (an ftp URL)
755 for url, ftp in [
756 ("file://ftp.example.com//foo.txt", True),
757 ("file://ftp.example.com///foo.txt", False),
759 ("file://ftp.example.com/foo.txt", False),
768 self.assertTrue(not ftp)
771 self.assertEqual(req.type, "ftp")
772 self.assertEqual(req.type == "ftp", ftp)
815 self.assertNotIn("Content-length", req.unredirected_hdrs)
816 self.assertNotIn("Content-type", req.unredirected_hdrs)
818 self.assertEqual(req.unredirected_hdrs["Content-length"], "0")
819 self.assertEqual(req.unredirected_hdrs["Content-type"],
820 "application/x-www-form-urlencoded")
826 req.add_unredirected_header("Content-length", "foo")
827 req.add_unredirected_header("Content-type", "bar")
831 self.assertEqual(req.unredirected_hdrs["Content-length"], "foo")
832 self.assertEqual(req.unredirected_hdrs["Content-type"], "bar")
935 req.add_header("Content-Length", str(len(data)))
953 self.assertNotIn("content-length", headers)
954 self.assertNotIn("content-type", headers)
968 # redirections with the sub-requests caused by the redirections.
982 # detect endless non-repeating chain of redirects
996 valid_schemes = ['http', 'https', 'ftp']
1112 req.add_header("Proxy-Authorization","FooBar")
1113 req.add_header("User-Agent","Grail")
1117 # Verify Proxy-Authorization gets tunneled to request.
1118 # httpsconn req_headers do not have the Proxy-Authorization header but
1120 self.assertNotIn(("Proxy-Authorization","FooBar"),
1122 self.assertIn(("User-Agent","Grail"),
1126 self.assertEqual(req.get_header("Proxy-authorization"),"FooBar")
1134 401, 'WWW-Authenticate: Basic realm=%s%s%s\r\n\r\n' %
1153 401, 'WWW-Authenticate: Basic realm=%s\r\n\r\n' % realm)
1156 msg = "Basic Auth Realm was unquoted"
1173 407, 'Proxy-Authenticate: Basic realm="%s"\r\n\r\n' % realm)
1176 self._test_basic_auth(opener, auth_handler, "Proxy-authorization",
1204 self.parent.record("basic")
1214 401, 'WWW-Authenticate: Basic realm="%s"\r\n\r\n' % realm)
1219 # check basic auth isn't blocked by digest handler failing
1225 # check digest was tried before basic (twice, because
1227 self.assertEqual(opener.recorded, ["digest", "basic"]*2)
1252 auth_hdr_value = 'Basic '+base64.encodestring(userpass).strip()
1327 headers={"X-Test": "test"})
1399 Issue 15701= - HTTPError interface has info method available from URLError.
1402 code=None, hdrs='Content-Length:42', fp=None)
1411 self.assertEqual(err.info(), "Content-Length:42")