formatting

This commit is contained in:
Ryan Oldenburg 2020-11-08 17:34:09 -06:00
parent 102fca266a
commit a50985ff8d
5 changed files with 14 additions and 15 deletions

View File

@ -1,7 +1,7 @@
import httpclient, zippy, strformat
import httpclient, strformat, zippy
let client = newHttpClient()
client.headers = newHttpHeaders({ "Accept-Encoding": "gzip" })
client.headers = newHttpHeaders({"Accept-Encoding": "gzip"})
let
response = client.request("http://www.google.com")

View File

@ -1,11 +1,11 @@
import asynchttpserver, asyncdispatch, zippy
import asyncdispatch, asynchttpserver, zippy
let server = newAsyncHttpServer()
proc cb(req: Request) {.async.} =
if req.headers["Accept-Encoding"].contains("gzip"):
# This client supports gzip, send compressed response
let headers = newHttpHeaders([("Content-Encoding","gzip")])
let headers = newHttpHeaders([("Content-Encoding", "gzip")])
await req.respond(
Http200,
compress("gzip'ed response body", dfGzip),

View File

@ -1,4 +1,4 @@
import strformat, strutils, fidget/opengl/perf
import fidget/opengl/perf, strformat, strutils
const
minMatchLen = 3
@ -82,12 +82,11 @@ proc lz77Encode2(src: seq[uint8]): seq[uint16] =
break
inc chainLen
let offset = (
var offset: int
if hashPos <= windowPos:
windowPos - hashPos
offset = (windowPos - hashPos).int
else:
windowPos - hashPos + windowSize
).int
offset = (windowPos - hashPos + windowSize).int
if offset <= 0 or offset < prevOffset:
break