summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2016-06-02 19:19:47 +0100
committerDominik Picheta <dominikpicheta@gmail.com>2016-06-02 19:19:47 +0100
commit9df1704aa159139e99c2a887d6a3b7cf0cbf75ae (patch)
tree07d75ac4de2c9cd07ee4c88efe94ff1c5f30081f
parentb33fbedec0c875f966ab674404d0b4561a410ef7 (diff)
downloadNim-9df1704aa159139e99c2a887d6a3b7cf0cbf75ae.tar.gz
Let asynchttpserver pass control of socket to cb for upgrades.
-rw-r--r--lib/pure/asynchttpserver.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim
index efd971606..31a33173c 100644
--- a/lib/pure/asynchttpserver.nim
+++ b/lib/pure/asynchttpserver.nim
@@ -28,8 +28,7 @@
 import tables, asyncnet, asyncdispatch, parseutils, uri, strutils
 import httpcore
 
-export HttpHeaders, httpcore.`[]`, httpcore.`[]=`, httpcore.add, httpcore.`==`,
-  httpcore.HttpCode, httpcore.HttpVersion, httpcore.toString
+export httpcore except parseHeader
 
 # TODO: If it turns out that the decisions that asynchttpserver makes
 # explicitly, about whether to close the client sockets or upgrade them are
@@ -186,6 +185,9 @@ proc processClient(client: AsyncSocket, address: string,
       await request.respond(Http400, "Invalid request method. Got: " &
         request.reqMethod)
 
+    if "upgrade" in request.headers.getOrDefault("connection"):
+      return
+
     # Persistent connections
     if (request.protocol == HttpVer11 and
         request.headers.getOrDefault("connection").normalize != "close") or