mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-21 05:53:12 +00:00
Merge pull request #137 from warner/2312-deprecation
Appease req.setHeader by passing bytes, not ints.
This commit is contained in:
commit
6f74282688
@ -206,7 +206,7 @@ def plural(sequence_or_length):
|
||||
def text_plain(text, ctx):
|
||||
req = IRequest(ctx)
|
||||
req.setHeader("content-type", "text/plain")
|
||||
req.setHeader("content-length", len(text))
|
||||
req.setHeader("content-length", b"%d" % len(text))
|
||||
return text
|
||||
|
||||
class WebError(Exception):
|
||||
@ -315,7 +315,7 @@ class MyExceptionHandler(appserver.DefaultExceptionHandler):
|
||||
req.setHeader("content-type", "text/plain;charset=utf-8")
|
||||
if isinstance(text, unicode):
|
||||
text = text.encode("utf-8")
|
||||
req.setHeader("content-length", str(len(text)))
|
||||
req.setHeader("content-length", b"%d" % len(text))
|
||||
req.write(text)
|
||||
# TODO: consider putting the requested URL here
|
||||
req.finishRequest(False)
|
||||
|
@ -452,7 +452,7 @@ class FileDownloader(rend.Page):
|
||||
contentsize = last - first + 1
|
||||
size = contentsize
|
||||
|
||||
req.setHeader("content-length", str(contentsize))
|
||||
req.setHeader("content-length", b"%d" % contentsize)
|
||||
if req.method == "HEAD":
|
||||
return ""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user