Sfoglia il codice sorgente

Sync with websockify. Save handshake headers.

Derived classes will almost certainly want to make use of the raw
info.
Joel Martin 14 anni fa
parent
commit
41b9ae6ec9
1 ha cambiato i file con 7 aggiunte e 5 eliminazioni
  1. 7 5
      utils/websocket.py

+ 7 - 5
utils/websocket.py

@@ -282,10 +282,10 @@ Connection: Upgrade\r
 
         #self.msg("handshake: " + repr(handshake))
         # Parse client WebSockets handshake
-        h = self.parse_handshake(handshake)
+        self.headers = self.parse_handshake(handshake)
 
-        if h.get('key3'):
-            trailer = self.gen_md5(h)
+        if self.headers.get('key3'):
+            trailer = self.gen_md5(self.headers)
             pre = "Sec-"
             ver = 76
         else:
@@ -297,8 +297,10 @@ Connection: Upgrade\r
                     % (address[0], stype, ver))
 
         # Send server WebSockets handshake response
-        response = self.server_handshake % (pre, h['Origin'], pre,
-                scheme, h['Host'], h['path'], pre, trailer)
+        response = self.server_handshake % (pre,
+                self.headers['Origin'], pre, scheme,
+                self.headers['Host'], self.headers['path'], pre,
+                trailer)
         #self.msg("sending response:", repr(response))
         retsock.send(response)