File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -669,3 +669,14 @@ def test_inside_script(self):
669
669
get_meta_refresh (body , baseurl , ignore_tags = ()),
670
670
(0.0 , "http://example.org/foobar_required" ),
671
671
)
672
+
673
+ def test_redirections_in_different_ordering__in_meta_tag (self ):
674
+ baseurl = 'http://localhost:8000'
675
+ url1 = '<html><head><meta http-equiv="refresh" content="0;url=dummy.html"></head></html>'
676
+ url2 = '<html><head><meta content="0;url=dummy.html" http-equiv="refresh"></head></html>'
677
+ self .assertEqual (
678
+ get_meta_refresh (url1 , baseurl ), (0.0 , 'http://localhost:8000/dummy.html' )
679
+ )
680
+ self .assertEqual (
681
+ get_meta_refresh (url2 , baseurl ), (0.0 , 'http://localhost:8000/dummy.html' )
682
+ )
Original file line number Diff line number Diff line change 21
21
r'<meta\s[^>]*http-equiv[^>]*refresh[^>]*content\s*=\s*(?P<quote>["\'])(?P<int>(\d*\.)?\d+)\s*;\s*url=\s*(?P<url>.*?)(?P=quote)' ,
22
22
re .DOTALL | re .IGNORECASE ,
23
23
)
24
+ _meta_refresh_re2 = re .compile (
25
+ r'<meta\s[^>]*content\s*=\s*(?P<quote>["\'])(?P<int>(\d*\.)?\d+)\s*;\s*url=\s*(?P<url>.*?)(?P=quote)\shttp-equiv="refresh"' ,
26
+ re .DOTALL | re .IGNORECASE ,
27
+ )
28
+
24
29
_cdata_re = re .compile (
25
30
r"((?P<cdata_s><!\[CDATA\[)(?P<cdata_d>.*?)(?P<cdata_e>\]\]>))" , re .DOTALL
26
31
)
@@ -338,7 +343,7 @@ def get_meta_refresh(
338
343
raise
339
344
utext = remove_tags_with_content (utext , ignore_tags )
340
345
utext = remove_comments (replace_entities (utext ))
341
- m = _meta_refresh_re .search (utext )
346
+ m = _meta_refresh_re .search (utext ) or _meta_refresh_re2 . search ( utext )
342
347
if m :
343
348
interval = float (m .group ("int" ))
344
349
url = safe_url_string (m .group ("url" ).strip (" \" '" ), encoding )
You can’t perform that action at this time.
0 commit comments