branch: master commit e5033ebd3771aa3f40ac1c3a0c849218403ebb50 Author: Andrew Hyatt <ahy...@gmail.com> Commit: Andrew Hyatt <ahy...@gmail.com>
Allow websocket accept header variants. * packages/websocket/websocket.el (websocket-verify-headers): Some clients send the alternate capitalization Sec-Websocket-Accept, so accept this alternate version. --- packages/websocket/websocket.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/websocket/websocket.el b/packages/websocket/websocket.el index 68e847c..1d69508 100644 --- a/packages/websocket/websocket.el +++ b/packages/websocket/websocket.el @@ -4,7 +4,7 @@ ;; Author: Andrew Hyatt <ahy...@gmail.com> ;; Keywords: Communication, Websocket, Server -;; Version: 1.11.1 +;; Version: 1.12 ;; Package-Requires: ((cl-lib "0.5")) ;; ;; This program is free software; you can redistribute it and/or @@ -100,7 +100,7 @@ same for the protocols." accept-string (inflight-input nil)) -(defvar websocket-version "1.11.1" +(defvar websocket-version "1.12" "Version numbers of this version of websocket.el.") (defvar websocket-debug nil @@ -797,10 +797,10 @@ connection is invalid, the connection will be closed." The output is assumed to have complete headers. This function will either return t or call `error'. This has the side-effect of populating the list of server extensions to WEBSOCKET." - (let ((accept-string - (concat "Sec-WebSocket-Accept: " (websocket-accept-string websocket)))) - (websocket-debug websocket "Checking for accept header: %s" accept-string) - (unless (string-match (regexp-quote accept-string) output) + (let ((accept-regexp + (concat "Sec-Web[Ss]ocket-Accept: " (regexp-quote (websocket-accept-string websocket))))) + (websocket-debug websocket "Checking for accept header regexp: %s" accept-regexp) + (unless (string-match accept-regexp output) (signal 'websocket-invalid-header (list "Incorrect handshake from websocket: is this really a websocket connection?")))) (let ((case-fold-search t))