Skip to content

Commit

Permalink
1.6.1dev: remove workaround for Internet Explorer when post and redir…
Browse files Browse the repository at this point in the history
…ect with hash (closes #13628)

git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.6-stable@17755 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information
jomae committed Nov 17, 2023
1 parent 37df114 commit 318e37a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 59 deletions.
5 changes: 0 additions & 5 deletions trac/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
## jinjacheck: "attribute content" OK
# endfor

<!--[if IE]><script>
if (/^#__msie303:/.test(window.location.hash))
window.location.replace(window.location.hash.replace(/^#__msie303:/, '#'));
</script><![endif]-->

# if chrome.links:
# for rel, links in chrome.links.items():
# for link in links:
Expand Down
10 changes: 0 additions & 10 deletions trac/web/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
44 changes: 0 additions & 44 deletions trac/web/tests/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 318e37a

Please sign in to comment.