mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-13 19:46:28 +00:00
Fix content-length crash
This commit is contained in:
parent
2d7e12fcb8
commit
3107ab0ab8
1 changed files with 7 additions and 1 deletions
|
@ -44,9 +44,15 @@ proc proxyMedia*(req: jester.Request; url: string): Future[HttpCode] {.async.} =
|
||||||
if request.headers.getOrDefault("If-None-Match") == hashed:
|
if request.headers.getOrDefault("If-None-Match") == hashed:
|
||||||
return Http304
|
return Http304
|
||||||
|
|
||||||
|
let contentLength =
|
||||||
|
if res.headers.hasKey("content-length"):
|
||||||
|
res.headers["content-length", 0]
|
||||||
|
else:
|
||||||
|
""
|
||||||
|
|
||||||
let headers = newHttpHeaders({
|
let headers = newHttpHeaders({
|
||||||
"Content-Type": res.headers["content-type", 0],
|
"Content-Type": res.headers["content-type", 0],
|
||||||
"Content-Length": res.headers["content-length", 0],
|
"Content-Length": contentLength,
|
||||||
"Cache-Control": maxAge,
|
"Cache-Control": maxAge,
|
||||||
"ETag": hashed
|
"ETag": hashed
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue