Skip to content
Permalink
Browse files
Fix serve (don’t bother with f.tell)
cc @Aeyoun

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Aug 6, 2015
1 parent dc4cedd commit 29c2fae5293ae508139aeed15dacf963a4052301
Showing 1 changed file with 2 additions and 2 deletions.
@@ -231,15 +231,15 @@ def send_head(self):

filtered_bytes = None
if ctype == 'text/html':
"""Comment out any <base> to allow local resolution of relative URLs."""
# Comment out any <base> to allow local resolution of relative URLs.
data = f.read().decode('utf8')
f.close()
data = re.sub(r'<base\s([^>]*)>', '<!--base \g<1>-->', data, re.IGNORECASE)
data = data.encode('utf8')
f = StringIO()
f.write(data)
filtered_bytes = len(data)
f.seek(0)
filtered_bytes = f.tell()

self.send_response(200)
self.send_header("Content-type", ctype)

0 comments on commit 29c2fae

Please sign in to comment.