# # # patch "wrapper.py" # from [6f866770c63c39c45e36479bf0c859f6add8c28f] # to [a3b890f3aa3d092d6ab1c8e9d3d401e83ddfe316] # ============================================================ --- wrapper.py 6f866770c63c39c45e36479bf0c859f6add8c28f +++ wrapper.py a3b890f3aa3d092d6ab1c8e9d3d401e83ddfe316 @@ -36,7 +36,7 @@ if mime_type == None: mime_type = mimetypes.guess_type(form['path'])[0] req.headers_out["Content-Disposition"] = "attachment; filename=%s" % urllib.quote(os.path.split(form['path'])[-1]) if mime_type == None: mime_type = "text/plain" - req.content_type = mime_type + req.content_type = mime_type + "; charset=utf-8" req.write(mt.file(id)) return apache.OK @@ -50,7 +50,7 @@ id1, id2 = form['id1'], form['id2'] if not monotone.is_valid_id(id1) or not monotone.is_valid_id(id2): return apache.HTTP_BAD_REQUEST - req.content_type = "text/plain" + req.content_type = "text/plain; charset=utf-8" req.write(mt.diff(id1, id2, files)) return apache.OK @@ -60,7 +60,7 @@ if not form.has_key('className') or not form.has_key('linkUri'): return apache.HTTP_BAD_REQUEST class_name, link_uri = form['className'], form['linkUri'] - req.content_type = "text/plain" + req.content_type = "text/plain; charset=utf-8" writer = json.JsonWriter() query = {} for key, value in [t.split('=', 1) for t in urlparse.urlparse(link_uri)[4].split('&')]: @@ -139,7 +139,7 @@ id = form['id'] tar_file = DummyFile("") tar_file_name = "%s.tar" % (id) - req.content_type = 'application/x-tar' + req.content_type = 'application/x-tar; charset=utf-8' req.headers_out["Content-Disposition"] = "attachment; filename=%s" % tar_file_name tf = tarfile.open(mode="w", fileobj=tar_file) for fileid, filename in mt.manifest(id): @@ -170,7 +170,6 @@ del mt def handler(req): - req.content_type = "text/plain" uri = req.uri slash = uri.rfind('/') if slash <> -1: uri = uri[slash+1:] @@ -198,6 +197,8 @@ # agent # if handlers.has_key(uri): + if req.header_only: + return apache.OK return handlers[uri](req, vars) # @@ -205,7 +206,8 @@ # try: if uri.endswith('.psp') and sane_uri_re.match(uri[:-4]): - req.content_type = "text/html" + if req.header_only: + return apache.OK instance = psp.PSP(req, filename=uri, vars=vars) instance.run() return apache.OK