Issue1752919
Created on 2007-07-12 19:28 by eugine_kosenko, last changed 2009-04-22 05:07 by ajaksu2.
|
msg32487 - (view) |
Author: Eugine Kosenko (eugine_kosenko) |
Date: 2007-07-12 19:28 |
|
import HTMLParser
p = HTMLParser.HTMLParser()
p.feed("""
<script>
<!--
bmD.write('</sc'+'ript>');
//-->
</script>
""")
Traceback (most recent call last):
File "<stdin>", line 4, in ?
File "/usr/lib/python2.4/HTMLParser.py", line 108, in feed
self.goahead(0)
File "/usr/lib/python2.4/HTMLParser.py", line 150, in goahead
k = self.parse_endtag(i)
File "/usr/lib/python2.4/HTMLParser.py", line 314, in parse_endtag
self.error("bad end tag: %r" % (rawdata[i:j],))
File "/usr/lib/python2.4/HTMLParser.py", line 115, in error
raise HTMLParseError(message, self.getpos())
HTMLParser.HTMLParseError: bad end tag: "</sc'+'ript>", at line 4, column 12
The JavaScript code is protected via HTML comment, so HTMLParser must skip it entirely, and the parsing must be successfull.
Instead of this, the JavaScript code is parsed as a part of the HTML page, and incorrect end tag is detected. If one move the actual end tag </script> up just after start tag <script>, the code is parsed without errors.
Hence the code seems to be artificial, it is used often in real site counters to prevent the blocking of them.
|
|
msg85681 - (view) |
Author: Daniel Diniz (ajaksu2) |
Date: 2009-04-07 04:03 |
|
Confirmed in trunk, py3k.
|
|
| Date |
User |
Action |
Args |
| 2009-04-22 05:07:32 | ajaksu2 | set | keywords:
+ easy |
| 2009-04-07 04:03:20 | ajaksu2 | set | versions:
+ Python 2.6, Python 3.1, - Python 2.4 nosy:
+ ajaksu2
messages:
+ msg85681
type: behavior stage: test needed |
| 2007-07-12 19:28:02 | eugine_kosenko | create | |
|