diff options
author | LemonBoy <thatlemon@gmail.com> | 2019-02-03 12:50:37 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2019-02-04 22:16:55 +0000 |
commit | bcb5995ddf1228a53e01c9947e5229994e1bf364 (patch) | |
tree | 4ddd61f148a5367c36a22755e3db20719d31c356 /lib | |
parent | 59574b89a6ac0dcdd09a7fcd0d9c7662f78f97e9 (diff) | |
download | Nim-bcb5995ddf1228a53e01c9947e5229994e1bf364.tar.gz |
Fix regression w/ keep-alive connections to AsyncHttpServer
We should keep listening if the connection is marked as keep-alive. Fixes #10536
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/asynchttpserver.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim index be56ce2d8..edccd6628 100644 --- a/lib/pure/asynchttpserver.nim +++ b/lib/pure/asynchttpserver.nim @@ -264,6 +264,9 @@ proc processRequest( if "upgrade" in request.headers.getOrDefault("connection"): return false + # The request has been served, from this point on returning `true` means the + # connection will not be closed and will be kept in the connection pool. + # Persistent connections if (request.protocol == HttpVer11 and cmpIgnoreCase(request.headers.getOrDefault("connection"), "close") != 0) or @@ -273,7 +276,7 @@ proc processRequest( # header states otherwise. # In HTTP 1.0 we assume that the connection should not be persistent. # Unless the connection header states otherwise. - discard + return true else: request.client.close() return false |