From 318e37afec8b455bcdcff74d14bf3c3b11a30530 Mon Sep 17 00:00:00 2001 From: jomae Date: Fri, 17 Nov 2023 09:43:00 +0000 Subject: [PATCH] 1.6.1dev: remove workaround for Internet Explorer when post and redirect with hash (closes #13628) git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.6-stable@17755 af82e41b-90c4-0310-8c96-b1721e28e2e2 --- trac/templates/layout.html | 5 ----- trac/web/api.py | 10 --------- trac/web/tests/api.py | 44 -------------------------------------- 3 files changed, 59 deletions(-) diff --git a/trac/templates/layout.html b/trac/templates/layout.html index 4a3d7e0c6f..da39ceef2e 100644 --- a/trac/templates/layout.html +++ b/trac/templates/layout.html @@ -31,11 +31,6 @@ ## jinjacheck: "attribute content" OK # endfor - - # if chrome.links: # for rel, links in chrome.links.items(): # for link in links: diff --git a/trac/web/api.py b/trac/web/api.py index b27ebc080e..6a3a9cb99a 100644 --- a/trac/web/api.py +++ b/trac/web/api.py @@ -829,8 +829,6 @@ def check_modified(self, datetime, extra=''): self.end_headers() raise RequestDone - _trident_re = re.compile(r' Trident/([0-9]+)') - def redirect(self, url, permanent=False): """Send a redirect to the client, forwarding to the specified URL. @@ -854,14 +852,6 @@ def redirect(self, url, permanent=False): url = urllib.parse.urlunparse((scheme, host, url, None, None, None)) - # Workaround #10382, IE6-IE9 bug when post and redirect with hash - if status == 303 and '#' in url: - user_agent = self.environ.get('HTTP_USER_AGENT', '') - match_trident = self._trident_re.search(user_agent) - if ' MSIE ' in user_agent and \ - (not match_trident or int(match_trident.group(1)) < 6): - url = url.replace('#', '#__msie303:') - self.send_header('Location', url) self.send_header('Content-Type', 'text/plain') self.send_header('Content-Length', 0) diff --git a/trac/web/tests/api.py b/trac/web/tests/api.py index 663d8f2a9e..c69d9d3907 100644 --- a/trac/web/tests/api.py +++ b/trac/web/tests/api.py @@ -410,50 +410,6 @@ def test_redirect_absolute(self): self.assertEqual('http://example.com/trac/test', req.headers_sent['Location']) - def test_redirect_with_post_and_hash_for_msie(self): - url = 'http://example.com/trac/ticket/1#comment:2' - msie303 = 'http://example.com/trac/ticket/1#__msie303:comment:2' - - def location(ua): - environ = _make_environ(method='POST', HTTP_USER_AGENT=ua) - req = _make_req(environ) - with self.assertRaises(RequestDone): - req.redirect(url) - self.assertEqual('303 See Other', req.status_sent[0]) - return req.headers_sent['Location'] - - # IE 11 strict mode - self.assertEqual(url, location( - 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko')) - # IE 11 compatibility view mode - self.assertEqual(url, location( - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/7.0)')) - # IE 10 strict mode - self.assertEqual(url, location( - 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)' - )) - # IE 10 compatibility view mode - self.assertEqual(url, location( - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/6.0)')) - # IE 9 strict mode - self.assertEqual(msie303, location( - 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)')) - # IE 9 compatibility view mode - self.assertEqual(msie303, location( - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0)')) - # IE 8 strict mode - self.assertEqual(msie303, location( - 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)')) - # IE 8 compatibility view mode - self.assertEqual(msie303, location( - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)')) - # IE 7 - self.assertEqual(msie303, location( - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)')) - # IE 6 - self.assertEqual(msie303, location( - 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)')) - def test_write_iterable(self): req = _make_req(_make_environ(method='GET')) req.send_header('Content-Type', 'text/plain;charset=utf-8')