1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

rewrite: leave out charset in top-frame and don't modify it in replay frame

to allow browser to detect best charset, as it would on original page if it is absent)
see #170 for details
This commit is contained in:
Ilya Kreymer 2016-02-25 18:25:53 -08:00
parent c76aa17b78
commit 8fc789cc8f
3 changed files with 5 additions and 4 deletions

View File

@ -237,8 +237,9 @@ class RewriteContent:
m = RewriteContent.CHARSET_REGEX.search(buff)
if m:
charset = m.group(1)
content_type = 'text/html; charset=' + charset
status_headers.replace_header('content-type', content_type)
# content_type = 'text/html; charset=' + charset
# status_headers.replace_header('content-type', content_type)
return charset
@staticmethod

View File

@ -207,7 +207,7 @@ def test_example_1():
# verify utf-8 charset detection
assert status_headers.get_header('content-type') == 'text/html; charset=utf-8'
assert status_headers.get_header('content-type') == 'text/html'
assert '/pywb/20131226101010/http://www.iana.org/domains/example' in buff, buff

View File

@ -107,7 +107,7 @@ class SearchPageWbUrlHandler(WbUrlHandler):
def get_top_frame_response(self, wbrequest):
params = self.get_top_frame_params(wbrequest, mod=self.replay_mod)
headers = [('Content-Type', 'text/html; charset=utf-8')]
headers = [('Content-Type', 'text/html')]
status_headers = StatusAndHeaders('200 OK', headers)
template_result = self.frame_insert_view.render_to_string(**params)