diff -r 37671fc60f34 Lib/test/test_urlparse.py --- a/Lib/test/test_urlparse.py Thu Sep 16 17:04:49 2010 +0200 +++ b/Lib/test/test_urlparse.py Tue Sep 28 15:42:28 2010 -0400 @@ -493,6 +493,16 @@ self.assertEqual(urllib.parse.urlparse("x-newscheme://foo.com/stuff"), ('x-newscheme', 'foo.com', '/stuff', '', '', '')) + def test_mailto_headers(self): + """Tests that urllib.parse.urlparse() returns headers in mailto: links + as query parameters. + + """ + # Issue 6640: mailto: headers should be returned as query parameters + eq = self.assertEqual + result = urllib.parse.urlparse('mailto:foo@example.com?subject=hi') + eq(result, ('mailto', '', 'foo@example.com', '', 'subject=hi', '')) + def test_main(): support.run_unittest(UrlParseTestCase) diff -r 37671fc60f34 Lib/urllib/parse.py --- a/Lib/urllib/parse.py Thu Sep 16 17:04:49 2010 +0200 +++ b/Lib/urllib/parse.py Tue Sep 28 15:42:28 2010 -0400 @@ -49,7 +49,7 @@ 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips', 'mms', '', 'sftp'] uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms', - 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', ''] + 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', 'mailto', ''] uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais', 'https', 'shttp', 'snews', 'file', 'prospero', '']