;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\307\310\311\312!\"\210\307\313\314\312!\"\210\307\315\313\"\210\316\315\317\320#\210\321\312\322\313#\323\312\324\325\324$\210\326\327\324\330\324\331%\210\326\332\324\333\324\334%\210\326\335\324\336\324\337%\210\326\340\324\341\324\342%\210\326\343\324\344\324\345%\210\326\346\324\347\324\350%\210\326\351\324\352\324\353%\210\326\354\324\355\324\356%\207" [require web-server-status-codes mail-parse mm-encode url-util eieio cl-lib defalias ws-server-p eieio-make-class-predicate ws-server ws-server--eieio-childp eieio-make-child-predicate ws-server-child-p make-obsolete "use (cl-typep ... \\='ws-server) instead" "25.1" define-symbol-prop cl-deftype-satisfies eieio-defclass-internal nil ((handlers :initarg :handlers :accessor ws-handlers :initform nil) (process :initarg :process :accessor ws-process :initform nil) (port :initarg :port :accessor ws-port :initform nil) (requests :initarg :requests :accessor ws-requests :initform nil)) cl-generic-define-method ws-requests ((this ws-server)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp requests eieio-oref] 4 "Retrieve the slot `requests' from an object of class `ws-server'.\n\n(fn THIS)"] \(setf\ ws-requests\) (value (this ws-server)) #[514 "\300\301#\207" [eieio-oset requests] 6 "\n\n(fn VALUE THIS)"] ws-port ((this ws-server)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp port eieio-oref] 4 "Retrieve the slot `port' from an object of class `ws-server'.\n\n(fn THIS)"] \(setf\ ws-port\) (value (this ws-server)) #[514 "\300\301#\207" [eieio-oset port] 6 "\n\n(fn VALUE THIS)"] ws-process ((this ws-server)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp process eieio-oref] 4 "Retrieve the slot `process' from an object of class `ws-server'.\n\n(fn THIS)"] \(setf\ ws-process\) (value (this ws-server)) #[514 "\300\301#\207" [eieio-oset process] 6 "\n\n(fn VALUE THIS)"] ws-handlers ((this ws-server)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp handlers eieio-oref] 4 "Retrieve the slot `handlers' from an object of class `ws-server'.\n\n(fn THIS)"] \(setf\ ws-handlers\) (value (this ws-server)) #[514 "\300\301#\207" [eieio-oset handlers] 6 "\n\n(fn VALUE THIS)"]] 7) #@66 Create a new object of class type `ws-server'. (fn &rest SLOTS) (defalias 'ws-server #[128 "\300\301\302#\207" [apply make-instance ws-server] 5 (#$ . 2360)]) (byte-code "\300\301\302\303#\300\207" [function-put ws-server compiler-macro ws-server--anon-cmacro] 4) #@26 (fn WHOLE &rest SLOTS) (defalias 'ws-server--anon-cmacro #[385 "\211@;\204\207\300\301\302@@#@\303@DABB\"\207" [macroexp-warn-and-return format "Obsolete name arg %S to constructor %S" identity] 7 (#$ . 2632)]) (byte-code "\300\301\302\303!\"\210\300\304\305\303!\"\210\300\306\304\"\210\307\306\310\311#\210\312\303\313\304#\314\303\315\316\315$\210\317\320\315\321\315\322%\210\317\323\315\324\315\325%\210\317\326\315\327\315\330%\210\317\331\315\332\315\333%\210\317\334\315\335\315\336%\210\317\337\315\340\315\341%\210\317\342\315\343\315\344%\210\317\345\315\346\315\347%\210\317\350\315\351\315\352%\210\317\353\315\354\315\355%\210\317\356\315\357\315\360%\210\317\361\315\362\315\363%\210\317\364\315\365\315\366%\210\317\367\315\370\315\371%\210\317\372\315\373\315\374%\210\317\375\315\376\315\377%\207" [defalias ws-request-p eieio-make-class-predicate ws-request ws-request--eieio-childp eieio-make-child-predicate ws-request-child-p make-obsolete "use (cl-typep ... \\='ws-request) instead" "25.1" define-symbol-prop cl-deftype-satisfies eieio-defclass-internal nil ((process :initarg :process :accessor ws-process :initform nil) (pending :initarg :pending :accessor ws-pending :initform #1="") (context :initarg :context :accessor ws-context :initform nil) (boundary :initarg :boundary :accessor ws-boundary :initform nil) (index :initarg :index :accessor ws-index :initform 0) (active :initarg :active :accessor ws-active :initform nil) (headers :initarg :headers :accessor ws-headers :initform (list nil)) (body :initarg :body :accessor ws-body :initform #1#)) cl-generic-define-method ws-body ((this ws-request)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp body eieio-oref] 4 "Retrieve the slot `body' from an object of class `ws-request'.\n\n(fn THIS)"] \(setf\ ws-body\) (value (this ws-request)) #[514 "\300\301#\207" [eieio-oset body] 6 "\n\n(fn VALUE THIS)"] ws-headers ((this ws-request)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp headers eieio-oref] 4 "Retrieve the slot `headers' from an object of class `ws-request'.\n\n(fn THIS)"] \(setf\ ws-headers\) (value (this ws-request)) #[514 "\300\301#\207" [eieio-oset headers] 6 "\n\n(fn VALUE THIS)"] ws-active ((this ws-request)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp active eieio-oref] 4 "Retrieve the slot `active' from an object of class `ws-request'.\n\n(fn THIS)"] \(setf\ ws-active\) (value (this ws-request)) #[514 "\300\301#\207" [eieio-oset active] 6 "\n\n(fn VALUE THIS)"] ws-index ((this ws-request)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp index eieio-oref] 4 "Retrieve the slot `index' from an object of class `ws-request'.\n\n(fn THIS)"] \(setf\ ws-index\) (value (this ws-request)) #[514 "\300\301#\207" [eieio-oset index] 6 "\n\n(fn VALUE THIS)"] ws-boundary ((this ws-request)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp boundary eieio-oref] 4 "Retrieve the slot `boundary' from an object of class `ws-request'.\n\n(fn THIS)"] \(setf\ ws-boundary\) (value (this ws-request)) #[514 "\300\301#\207" [eieio-oset boundary] 6 "\n\n(fn VALUE THIS)"] ws-context ((this ws-request)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp context eieio-oref] 4 "Retrieve the slot `context' from an object of class `ws-request'.\n\n(fn THIS)"] \(setf\ ws-context\) (value (this ws-request)) #[514 "\300\301#\207" [eieio-oset context] 6 "\n\n(fn VALUE THIS)"] ws-pending ((this ws-request)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp pending eieio-oref] 4 "Retrieve the slot `pending' from an object of class `ws-request'.\n\n(fn THIS)"] \(setf\ ws-pending\) (value (this ws-request)) #[514 "\300\301#\207" [eieio-oset pending] 6 "\n\n(fn VALUE THIS)"] ws-process ((this ws-request)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp process eieio-oref] 4 "Retrieve the slot `process' from an object of class `ws-request'.\n\n(fn THIS)"] \(setf\ ws-process\) (value (this ws-request)) #[514 "\300\301#\207" [eieio-oset process] 6 "\n\n(fn VALUE THIS)"]] 7) #@67 Create a new object of class type `ws-request'. (fn &rest SLOTS) (defalias 'ws-request #[128 "\300\301\302#\207" [apply make-instance ws-request] 5 (#$ . 6679)]) (byte-code "\300\301\302\303#\300\207" [function-put ws-request compiler-macro ws-request--anon-cmacro] 4) #@26 (fn WHOLE &rest SLOTS) (defalias 'ws-request--anon-cmacro #[385 "\211@;\204\207\300\301\302@@#@\303@DABB\"\207" [macroexp-warn-and-return format "Obsolete name arg %S to constructor %S" identity] 7 (#$ . 6956)]) #@31 List holding all web servers. (defvar ws-servers nil (#$ . 7184)) #@53 Logging time format passed to `format-time-string'. (defvar ws-log-time-format "%Y.%m.%d.%H.%M.%S.%N" (#$ . 7256)) #@34 This GUID is defined in RFC6455. (defvar ws-guid "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" (#$ . 7377)) #@1402 Start a server using HANDLERS and return the server object. HANDLERS may be a single function (which is then called on every request) or a list of conses of the form (MATCHER . FUNCTION), where the FUNCTION associated with the first successful MATCHER is called. Handler functions are called with two arguments, the process and the request object. A MATCHER may be either a function (in which case it is called on the request object) or a cons cell of the form (KEYWORD . STRING) in which case STRING is matched against the value of the header specified by KEYWORD. Any supplied NETWORK-ARGS are assumed to be keyword arguments for `make-network-process' to which they are passed directly. For example, the following starts a simple hello-world server on port 8080. (ws-start (lambda (request) (with-slots (process headers) request (process-send-string process "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nhello world"))) 8080) Equivalently, the following starts an identical server using a function MATCH and the `ws-response-header' convenience function. (ws-start `(((lambda (_) t) . (lambda (request) (with-slots ((proc process)) request (ws-response-header proc 200 '("Content-Type" . "text/plain")) (process-send-string proc "hello world"))))) 8080) (fn HANDLERS PORT &optional LOG-BUFFER &rest NETWORK-ARGS) (defalias 'ws-start #[898 "\302\303\304\305%\205\306!\307\310\311\312\313\314\315 !\316\317\320\321\322\323W\324\325\326\327\330\331\320D\2056\332D\"\333\205>\334&\"\266 B\207" [emacs-major-version ws-servers make-instance ws-server :handlers :port get-buffer-create \(setf\ ws-process\) apply make-network-process :name "ws-server" :service ws-port :filter ws-filter :server t :nowait 26 :family ipv4 :coding no-conversion :plist append :log-buffer :log #[771 "\301!\302\303!\304\"r\211q\210db\210\305\306\307!@A@%c)\207" [ws-log-time-format process-contact plist-get process-plist :log-buffer format "%s %s %s %s" format-time-string] 11 "\n\n(fn PROC REQUEST MESSAGE)"]] 29 (#$ . 7486)]) #@27 Stop SERVER. (fn SERVER) (defalias 'ws-stop #[257 "\301\"\302\303\304\305\306\307!\"\306!C\"\"\207" [ws-servers remove mapc delete-process append mapcar ws-process ws-requests] 8 (#$ . 9619)]) #@35 Stop all servers in `ws-servers'. (defalias 'ws-stop-all #[0 "\301\302\"\207" [ws-servers mapc ws-stop] 3 (#$ . 9825) nil]) #@74 HTTP methods from http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html. (defvar ws-http-common-methods '(GET HEAD POST PUT DELETE TRACE) (#$ . 9956)) (defvar ws-http-method-rx (byte-code "\301\302\303\304\305#\"\207" [ws-http-common-methods format "^\\(%s\\) \\([^[:space:]]+\\) \\([^[:space:]]+\\)$" mapconcat symbol-name "\\|"] 6)) #@60 Thin wrapper around `url-parse-query-string'. (fn STRING) (defalias 'ws-parse-query-string #[257 "\300\301\302\303\304#\"\207" [mapcar #[257 "\211@A@B\207" [] 3 "\n\n(fn PAIR)"] url-parse-query-string nil allow-newlines] 7 (#$ . 10298)]) #@74 Parse HTTP headers in STRING reporting errors to PROC. (fn PROC STRING) (defalias 'ws-parse #[514 "\301\302\"\2030\211\303\304\"!\303\305\"\302\306\"\203+\307\211\224OB\310\311\307\225\312O!!B\207BC\207\302\313\"\203w\211\303\304\"!\303\305\"\314\211\315=\203l\316!\302\317\"\203a\211\307\211\224O\307\225\312OB\202g\320\321#\262\202s\320\322#BBC\207\302\323\"\203\213\211\303\304\"!\303\305\"BC\207\320\324#\210\312\207" [ws-http-method-rx #[257 "\300\301\226P!\207" [intern ":"] 4 "\n\n(fn S)"] string-match match-string 1 2 "?" 0 ws-parse-query-string url-unhex-string nil "^AUTHORIZATION: \\([^[:space:]]+\\) \\(.*\\)$" :AUTHORIZATION :BASIC base64-decode-string ":" ws-error "bad credentials: %S" "un-support protocol: %s" "^\\([^[:space:]]+\\): \\(.*\\)$" "bad header: %S"] 12 (#$ . 10545)]) #@15 (fn STRING) (defalias 'ws-trim #[257 "\211G\300V\203/\301\302\303\304O\"\203\211\300\303O\211\262\204\301\302\300\305O\"\203/\211\305\304O\211\262\204\207" [0 string-match "[ \n]" -1 nil 1] 6 (#$ . 11389)]) #@20 (fn PROC STRING) (defalias 'ws-parse-multipart/form #[514 "\300\301\"\205I\302\303\304\"!A\305\225\306\300\307#\211\262\2038\211U\2048\310!\311O\"\241\210\312\\\262\202\313\236A\314\312\\\306OBBB\266\203\207" [string-match "Content-Disposition:[[:space:]]*\\(.*\\) \n" mail-header-parse-content-disposition match-string 1 0 nil " \n" last ws-parse 2 name content] 11 (#$ . 11616)]) #@20 (fn PROC STRING) (defalias 'ws-filter #[514 "\300\301!\302\"\303\304\305\"\306\307\"\"\204&\211\310\307\311\312\313 #\306\307\"B#\266\303\304\314\"\306\307\"\"\211\211\310\315\306\315\"P#\266\316!?\205\217\211\317\320\"\266\3212c\322!\203a\323\306\324\"\"\202b\3250\325=?\205\217\300\301!\326\"\211\203x\327\"\210\210\310\307\330\304\331\n\"\306\307\"\"#\266\332!\207" [plist-get process-plist :server cl-find-if make-closure #[257 "\300\301!\232\207" [V0 ws-process] 4 "\n\n(fn C)"] slot-value requests eieio-oset make-instance ws-request :process #[257 "\300\301!\232\207" [V0 ws-process] 4 "\n\n(fn C)"] pending ws-active \(setf\ ws-active\) t close-connection ws-parse-request ws-call-handler handlers :keep-alive :ender process-send-string cl-remove-if #[257 "\301\300\302!\"\207" [V0 eql ws-process] 5 "\n\n(fn R)"] delete-process] 13 (#$ . 12030)]) #@114 Parse request STRING from REQUEST with process PROC. Return non-nil only when parsing is complete. (fn REQUEST) (defalias 'ws-parse-request #[257 "\3002g\211\301\302\303\"\203\304\302\303\"P\202\305P\306\211\307\302\310\"\302\311\"#\211\262\203\\G\\\302\311\"U\203\251\204_\302\310\"\302\311\"\306O\312\301\"\203[\313\314\315\306O#\266\210\316\262\302\317\"\320=\203\214\321\322\323\"\324\325\326\327\330\302\f\310\"\302 \311\"\306O!#!\"\210\331\300\316\"\210\202Q\302\317\"\332=\203\241\333\302\303\"P\262\202Q\331\300\316\"\210\202Q\302\317\"\332=\203\362\334\302\335\"!\336\302\337\"\302\310\"\302 \311\"O\"C\241\210\302\310\"G\315\\V\203Q\302\310\"\211\315\\O\304\230\203Q\331\300\316\"\210\202Q\340\302\337\"\302\310\"\302\311\"O\"\211@@\203F\211@@\341=\203F\342@A!\211\203&\211A\262\242\202-\343\344\345GD\"\313\303\211\236A#\266\313\317\346\227!#\266\334\302\335\"!\241\266\313\311#\266\202\266\211\347\306\"\266\3060\207" [finished-parsing-headers " \n" slot-value boundary "--" "" nil string-match pending index string-prefix-p eieio-oset body 2 t context application/x-www-form-urlencoded mapc make-closure #[257 "\301\302\300\303\"!C\241\207" [V0 last slot-value headers] 5 "\n\n(fn PAIR)"] ws-parse-query-string replace-regexp-in-string "\\+" " " ws-trim throw multipart/form-data " \n--" last headers ws-parse-multipart/form process ws-parse :CONTENT-TYPE mail-header-parse-content-type signal wrong-number-of-arguments (type &rest data) intern \(setf\ ws-active\)] 17 (#$ . 12936)]) #@25 (fn REQUEST HANDLERS) (defalias 'ws-call-handler #[514 "\30025\301!\203#\302\300\3031!0\202!\304\305!\306#\262\"\210\307\310\311\"\"\210\304\305!\312\313!#0\207" [matched-handler functionp throw (error) ws-error ws-process "Caught Error: %S" mapc make-closure #[257 "\211@A:\203\"\301@\302\300!\"\203\"\303A\301@\302\300!\"A\"\204.\304!\205E\300!\205E\305\306\3071;\300!0\202D\310\311\300!\312#\262\"\207" [V0 assoc ws-headers string-match functionp throw matched-handler (error) ws-error ws-process "Caught Error: %S"] 10 "\n\n(fn HANDLER)"] "no handler matched request: %S" ws-headers] 9 (#$ . 14544)]) #@28 (fn PROC MSG &rest ARGS) (defalias 'ws-error #[642 "\301\302!\303\"\304!\203)rq\210db\210\305\306\307!@A@\310\305\n\n#%c\210)\310\311$\207" [ws-log-time-format plist-get process-plist :log-buffer process-contact format "%s %s %s WS-ERROR: %s" format-time-string apply ws-send-500] 14 (#$ . 15190)]) (byte-code "\300\301\302\303!\"\210\300\304\305\303!\"\210\300\306\304\"\210\307\306\310\311#\210\312\303\313\304#\314\303\315\316\315$\210\317\320\315\321\315\322%\210\317\323\315\324\315\325%\210\317\326\315\327\315\330%\210\317\331\315\332\315\333%\210\317\334\315\335\315\336%\210\317\337\315\340\315\341%\210\317\342\315\343\315\344%\210\317\345\315\346\315\347%\210\317\350\315\351\315\352%\210\317\353\315\354\315\355%\210\317\356\315\357\315\360%\210\317\361\315\362\315\363%\207" [defalias ws-message-p eieio-make-class-predicate ws-message ws-message--eieio-childp eieio-make-child-predicate ws-message-child-p make-obsolete "use (cl-typep ... \\='ws-message) instead" "25.1" define-symbol-prop cl-deftype-satisfies eieio-defclass-internal nil ((process :initarg :process :accessor ws-process :initform #1="") (pending :initarg :pending :accessor ws-pending :initform #1#) (active :initarg :active :accessor ws-active :initform nil) (new :initarg :new :accessor ws-new :initform nil) (data :initarg :data :accessor ws-data :initform #1#) (handler :initarg :handler :accessor ws-handler :initform #1#)) cl-generic-define-method ws-handler ((this ws-message)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp handler eieio-oref] 4 "Retrieve the slot `handler' from an object of class `ws-message'.\n\n(fn THIS)"] \(setf\ ws-handler\) (value (this ws-message)) #[514 "\300\301#\207" [eieio-oset handler] 6 "\n\n(fn VALUE THIS)"] ws-data ((this ws-message)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp data eieio-oref] 4 "Retrieve the slot `data' from an object of class `ws-message'.\n\n(fn THIS)"] \(setf\ ws-data\) (value (this ws-message)) #[514 "\300\301#\207" [eieio-oset data] 6 "\n\n(fn VALUE THIS)"] ws-new ((this ws-message)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp new eieio-oref] 4 "Retrieve the slot `new' from an object of class `ws-message'.\n\n(fn THIS)"] \(setf\ ws-new\) (value (this ws-message)) #[514 "\300\301#\207" [eieio-oset new] 6 "\n\n(fn VALUE THIS)"] ws-active ((this ws-message)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp active eieio-oref] 4 "Retrieve the slot `active' from an object of class `ws-message'.\n\n(fn THIS)"] \(setf\ ws-active\) (value (this ws-message)) #[514 "\300\301#\207" [eieio-oset active] 6 "\n\n(fn VALUE THIS)"] ws-pending ((this ws-message)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp pending eieio-oref] 4 "Retrieve the slot `pending' from an object of class `ws-message'.\n\n(fn THIS)"] \(setf\ ws-pending\) (value (this ws-message)) #[514 "\300\301#\207" [eieio-oset pending] 6 "\n\n(fn VALUE THIS)"] ws-process ((this ws-message)) #[257 "\300\301\"\205 \302\301\"\207" [slot-boundp process eieio-oref] 4 "Retrieve the slot `process' from an object of class `ws-message'.\n\n(fn THIS)"] \(setf\ ws-process\) (value (this ws-message)) #[514 "\300\301#\207" [eieio-oset process] 6 "\n\n(fn VALUE THIS)"]] 7) #@67 Create a new object of class type `ws-message'. (fn &rest SLOTS) (defalias 'ws-message #[128 "\300\301\302#\207" [apply make-instance ws-message] 5 (#$ . 18450)]) (byte-code "\300\301\302\303#\300\207" [function-put ws-message compiler-macro ws-message--anon-cmacro] 4) #@26 (fn WHOLE &rest SLOTS) (defalias 'ws-message--anon-cmacro #[385 "\211@;\204\207\300\301\302@@#@\303@DABB\"\207" [macroexp-warn-and-return format "Obsolete name arg %S to constructor %S" identity] 7 (#$ . 18728)]) #@561 Establish a web socket connection with request. If the connection is successful this function will throw `:keep-alive' to `close-connection' skipping any remaining code in the request handler. If no web-socket connection is established (e.g., because REQUEST is not attempting to establish a connection) then no actions are taken and nil is returned. Second argument HANDLER should be a function of two arguments, the process and a string, which will be called on all complete messages as they are received and parsed from the network. (fn REQUEST HANDLER) (defalias 'ws-web-socket-connect #[514 "\300\301\302\"\236\205M\303\301\304\"\305\306\307B\310\311B\312\313\300\301 \302\"\236A!B%\210\314\301\304\"\315\"\210\316\301\304\"\317\320\321\322\323\301 \304\"%D\"\210\324\301\304\"\325\"\210\301\304\"\207" [:SEC-WEBSOCKET-KEY slot-value headers ws-response-header process 101 "Upgrade" "websocket" "Connection" "upgrade" "Sec-WebSocket-Accept" ws-web-socket-handshake set-process-coding-system binary set-process-plist :message make-instance ws-message :handler :process set-process-filter ws-web-socket-filter] 14 (#$ . 18958)]) #@23 (fn PROCESS STRING) (defalias 'ws-web-socket-filter #[514 "\300\301!\302\"\303!\203\211\304\"\266\202,\211\305\306!P\"\266\211\307\310\"\266\311!\210\211\307\312\"\207" [plist-get process-plist :message ws-active \(setf\ ws-new\) \(setf\ ws-pending\) ws-pending \(setf\ ws-active\) t ws-web-socket-parse-messages nil] 7 (#$ . 20111)]) #@25 (fn MASKING-KEY DATA) (defalias 'ws-web-socket-mask #[514 "\300\301\302G\303\245T\"\"\300\304\305\306#\"\207" [apply concat make-list 4 string cl-mapcar logxor] 9 (#$ . 20470)]) #@82 Web socket filter to pass whole frames to the client. See RFC6455. (fn MESSAGE) (defalias 'ws-web-socket-parse-messages #[257 "\211\300C\301\302\303\304\211\211\211\211\211   \305$\211@\262\306\305\307#\262\306\307\"!\211\310\267\202N\311\202W\312\202W\313\202W\314\202W\315\202W\316\202W\317\202W\320\202W\321\322\323\"\324#\262\262\210\325\326\"\204m\321\322\f\323\"\327\"\210   \305$\211@\262\306\305\"!\262\210\330=\204\224\321\322\f\323\"\331\"\210\332U\203\254\f\f\f\333$!\262\202\301\334U\203\301\f\f\f\335$!\262\203\330\306\322\f\336\" \242\f\211\242\307\\\240#\262\n\337\340\322\340\"\341\306\322\336\"\242\242\f\\#\"P#\266\203T\322 \340\" \337\340\342#\266 \337\343\304#\266 \337\336\342#\266 \337\344\304#\266\315=\204>\322\f\345\"\322 \323\"\"\266 \202z\346\322 \323\"\347\350\351\305\352\"\335\"\300\"\"\266 \202z \242\\\322\f\336\"GW\203x\n\337\336\322\336\"\242\\\304O#\266\266 \353!\205\203\354!\207" [0 #[514 "C\300\301\"\302\303\304#\305\306\307S\"!\"\210\305\310\301\"!\207" [make-bool-vector nil mapc make-closure #[257 "\302\303\"\300\242Y\205\300\211\242Z\240\210\301\304I\207" [V0 V1 expt 2 t] 5 "\n\n(fn PLACE)"] reverse number-sequence 0 append] 10 "\n\n(fn INT SIZE)"] #[257 "\300C\301\302\303\304\305\"\306!\"\"\207" [0 apply + mapcar make-closure #[257 "\211\203\f\301\302\300\242\"\202 \303\300\211\242T\240\210\207" [V0 expt 2 0] 4 "\n\n(fn BIT)"] reverse] 8 "\n\n(fn BITS)"] #[1028 "\300\301\302\303\304\"\305\306 \307\"\242 \211\242 \\\240#\"\"\207" [apply append mapcar make-closure #[257 "\300\301\"\207" [V0 8] 4 "\n\n(fn INT)"] cl-subseq slot-value pending] 14 "\n\n(fn OBJECT INDEX --CL-INT-TO-BITS-- LENGTH)"] nil 1 cl-subseq 4 #s(hash-table size 16 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (0 46 1 50 2 54 3 58 4 58 5 58 6 58 7 58 8 62 9 66 10 70 11 74 12 74 13 74 14 74 15 74)) :CONTINUATION :TEXT :BINARY :NON-CONTROL :CLOSE :PING :PONG :CONTROL ws-error slot-value process "Web Socket Fail: bad opcode %d" cl-every null "Web Socket Fail: non-zero RSV 1 2 or 3" t "Web Socket Fail: client must mask data" 126 2 127 8 pending eieio-oset data ws-web-socket-mask "" active new handler process-send-string unibyte-string logior lsh 7 ws-new ws-web-socket-parse-messages] 24 (#$ . 20661)]) #@74 Frame STRING for web socket communication. (fn STRING &optional OPCODE) (defalias 'ws-web-socket-frame #[513 "G\206\300\211\301\267\202\302\202\303\202\304\305\306#\205\307\262\310W\2033\311\312\313\302\314\"\"\"\202\233\315W\203S\311\312\313\302\314\"\"\310\316\313\317\"\320\"\316\320\"$\202\233\311\312\313\302\314\"\"\321\316\313\322\"\320\"\316\313\323\"\320\"\316\313\324\"\320\"\316\313 \325\"\320\"\316\313\n\326\"\320\"\316\313 \327\"\320\"\316\313\f\317\"\320\"\316\f\320\"&\nP\207" [:TEXT #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (:TEXT 13 :BINARY 17)) 1 2 error "cl-ecase failed: %s, %s" (:TEXT :BINARY) nil 126 unibyte-string logior lsh 7 65536 logand -8 255 127 -56 -48 -40 -32 -24 -16] 17 (#$ . 23065)]) #@61 Command used for the "compress" Content or Transfer coding. (defvar ws-compress-cmd "compress" (#$ . 23875)) #@60 Command used for the "deflate" Content or Transfer coding. (defvar ws-deflate-cmd "zlib-flate -compress" (#$ . 23990)) #@57 Command used for the "gzip" Content or Transfer coding. (defvar ws-gzip-cmd "gzip" (#$ . 24115)) #@59 Return a function which applies CMD to strings. (fn CMD) (defalias 'ws-encoding-cmd-to-fn '(macro . #[257 "\300\301\302\303\304\305\306\307BBBB\310BBBE\207" [lambda (s) with-temp-buffer (insert s) shell-command-on-region (point-min) (point-max) (nil 'replace) ((buffer-string))] 10 (#$ . 24218)])) #@82 Convert STRING to a valid chunk for HTTP chunked Transfer-encoding. (fn STRING) (defalias 'ws-chunk #[257 "\300\301\302!#\207" [format "%x \n%s \n" string-bytes] 5 (#$ . 24525)]) #@594 Send the headers for an HTTP response to PROC. CODE should be an HTTP status code, see `ws-status-codes' for a list of known codes. When "Content-Encoding" or "Transfer-Encoding" headers are supplied any subsequent data written to PROC using `ws-send' will be encoded appropriately including sending the appropriate data upon the end of transmission for chunked transfer encoding. For example with the header `("Content-Encoding" . "gzip")', any data subsequently written to PROC using `ws-send' will be compressed using the command specified in `ws-gzip-cmd'. (fn PROC CODE &rest HEADERS) (defalias 'ws-response-header #[642 "\301\302\"A\301\303\"A\203I\304\305\306\307!\211\310\267\2026\311\202?\312\202?\313\202?\314\202?\315\n\316 #\202?\317\320\321#\205?\322\262D\323 !\"\"\210\211\203\207\304\305\324\230\205Y\325\326D\327\307!\211\330\267\202t\331\202}\332\202}\333\202}\334\202}\317\320\335#\205}\322\262D\323\n!#\"\210\266\336\337\301\"A#\340\341\"B\342!\343\211D\241\210\344\345\314\346#\"\207" [ws-status-codes assoc "Content-Encoding" "Transfer-Encoding" set-process-plist append :content-encoding intern #s(hash-table size 9 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (compress 28 x-compress 28 deflate 32 x-deflate 32 gzip 36 x-gzip 36 identity 40 exi 44 pack200-zip 44)) #[257 "\301\302\303\"r\211q\210\304\305\"\216c\210\306ed\307\310%\210\311 *\207" [ws-compress-cmd generate-new-buffer #1=" *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] shell-command-on-region nil replace buffer-string] 8 "\n\n(fn S)"] #[257 "\301\302\303\"r\211q\210\304\305\"\216c\210\306ed\307\310%\210\311 *\207" [ws-deflate-cmd generate-new-buffer #1# t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] shell-command-on-region nil replace buffer-string] 8 "\n\n(fn S)"] #[257 "\301\302\303\"r\211q\210\304\305\"\216c\210\306ed\307\310%\210\311 *\207" [ws-gzip-cmd generate-new-buffer #1# t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] shell-command-on-region nil replace buffer-string] 8 "\n\n(fn S)"] identity ws-error "`%s' Content-encoding not supported." error "cl-ecase failed: %s, %s" (x-compress compress x-deflate deflate x-gzip gzip identity pack200-zip exi) nil process-plist "chunked" :ender "0 \n \n" :transfer-encoding #s(hash-table size 7 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (chunked 100 compress 104 x-compress 104 deflate 108 x-deflate 108 gzip 112 x-gzip 112)) ws-chunk #[257 "\301\302\303\"r\211q\210\304\305\"\216c\210\306ed\307\310%\210\311 *\207" [ws-compress-cmd generate-new-buffer #1# t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] shell-command-on-region nil replace buffer-string] 8 "\n\n(fn S)"] #[257 "\301\302\303\"r\211q\210\304\305\"\216c\210\306ed\307\310%\210\311 *\207" [ws-deflate-cmd generate-new-buffer #1# t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] shell-command-on-region nil replace buffer-string] 8 "\n\n(fn S)"] #[257 "\301\302\303\"r\211q\210\304\305\"\216c\210\306ed\307\310%\210\311 *\207" [ws-gzip-cmd generate-new-buffer #1# t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] shell-command-on-region nil replace buffer-string] 8 "\n\n(fn S)"] (chunked x-compress compress x-deflate deflate x-gzip gzip) format "HTTP/1.1 %d %s" mapcar #[257 "\300\301@A#\207" [format "%s: %s"] 5 "\n\n(fn H)"] last "" process-send-string mapconcat " \n"] 15 (#$ . 24714)]) #@134 Send STRING to process PROC. If any Content or Transfer encodings are in use, apply them to STRING before sending. (fn PROC STRING) (defalias 'ws-send #[514 "\300\301!\302\"\206\n\303\300\301!\304\"\206\303\305!!\"\207" [plist-get process-plist :content-encoding identity :transfer-encoding process-send-string] 9 (#$ . 28343)]) #@98 Send 500 "Internal Server Error" to PROC with an optional message. (fn PROC &rest MSG-AND-ARGS) (defalias 'ws-send-500 #[385 "\300\301\302#\210\303\203\304\305\"\202\306\"\210\307\310\311\"\207" [ws-response-header 500 ("Content-type" . "text/plain") process-send-string apply format "500 Internal Server Error" throw close-connection nil] 7 (#$ . 28689)]) #@86 Send 404 "Not Found" to PROC with an optional message. (fn PROC &rest MSG-AND-ARGS) (defalias 'ws-send-404 #[385 "\300\301\302#\210\303\203\304\305\"\202\306\"\210\307\310\311\"\207" [ws-response-header 404 ("Content-type" . "text/plain") process-send-string apply format "404 Not Found" throw close-connection nil] 7 (#$ . 29061)]) #@148 Send PATH to PROC. Optionally explicitly set MIME-TYPE, otherwise it is guessed by `mm-default-file-encoding'. (fn PROC PATH &optional MIME-TYPE) (defalias 'ws-send-file #[770 "\211\206 \300!\206 \301\302\303\304\305\"r\211q\210\306\307\"\216\310!\210\311\312\313B\314deZB$\210\315 *\262\"\207" [mm-default-file-encoding "application/octet-stream" process-send-string generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-file-contents-literally ws-response-header 200 "Content-type" "Content-length" buffer-string] 14 (#$ . 29410)]) #@180 Send a listing of files in DIRECTORY to PROC. Optional argument MATCH is passed to `directory-files' and may be used to limit the files sent. (fn PROC DIRECTORY &optional MATCH) (defalias 'ws-send-directory-list #[770 "\300\301\302\303B#\210\304\305\306\307\310\"\311\312#\313#\314Q\"\207" [ws-response-header 200 "Content-type" "text/html" process-send-string ""] 12 (#$ . 30029)]) #@239 Check if PATH is under the PARENT directory. If so return PATH, if not return nil. Note: the PARENT directory must be full expanded as with `expand-file-name' and should not contain e.g., "~" for a user home directory. (fn PARENT PATH) (defalias 'ws-in-directory-p #[514 "\211G\300U\203 \207\301\"\211GGY\205 \300GO\230\205 \211\207" [0 expand-file-name] 7 (#$ . 30667)]) #@513 Return a version of HANDLER protected by CREDENTIALS. HANDLER should be a function as passed to `ws-start', and CREDENTIALS should be an alist of elements of the form (USERNAME . PASSWORD). Optional argument REALM sets the realm in the authentication challenge. Optional arguments UNAUTH and INVALID should be functions which are called on the request when no authentication information, or invalid authentication information are provided respectively. (fn HANDLER CREDENTIALS &optional REALM UNAUTH INVALID) (defalias 'ws-with-authentication #[1282 "\300\301&\207" [make-closure #[257 "\211\305\306\307\"\236AA\211\2040\303\203\303!\207\310\306\311\"\312\313\314\315\302\206#\316\"B\317$\210\320\306\311\"\321\"\207\211A\322@\301\"A\230\203@\300!\207\304\203H\304!\207\310\306\311\"\323\324#\210\320\306\311\"\325\"\207" [V0 V1 V2 V3 V4 :AUTHORIZATION slot-value headers ws-response-header process 401 "WWW-Authenticate" format "Basic realm=%S" "restricted" ("Content-type" . "text/plain") process-send-string "authentication required" assoc 403 ("Content-type" . "text/plain") "invalid credentials"] 10 "\n\n(fn REQUEST)"]] 17 (#$ . 31058)]) #@53 Perform the handshake defined in RFC6455. (fn KEY) (defalias 'ws-web-socket-handshake #[257 "\301\302\303!P\304\211\305$!\207" [ws-guid base64-encode-string sha1 ws-trim nil binary] 7 (#$ . 32242)]) (byte-code "\300\301\302\303#\210\304\301\302\305#\210\300\306\307\303#\210\304\306\307\305#\210\300\310\311\303#\210\304\310\311\305#\210\300\312\313\303#\210\304\312\313\305#\210\300\314\315\303#\210\304\314\315\305#\210\300\316\317\303#\210\304\316\317\305#\210\300\320\321\303#\210\304\320\321\305#\210\300\322\323\303#\210\304\322\323\305#\210\300\324\325\303#\210\304\324\325\305#\210\300\326\327\303#\210\304\326\327\305#\210\300\330\331\303#\210\304\330\331\305#\210\300\332\333\303#\210\304\332\333\305#\210\300\334\335\303#\210\304\334\335\305#\210\300\336\337\303#\210\304\336\337\305#\210\340\341!\207" [defalias active ws-active nil make-obsolete "2020-03-12" body ws-body boundary ws-boundary context ws-context data ws-data handler ws-handler handlers ws-handlers headers ws-headers index ws-index new ws-new pending ws-pending port ws-port process ws-process requests ws-requests provide web-server] 4)