]> code.delx.au - gnu-emacs-elpa/commitdiff
match more HTTP methods
authorEric Schulte <schulte.eric@gmail.com>
Fri, 20 Dec 2013 17:41:46 +0000 (10:41 -0700)
committerEric Schulte <schulte.eric@gmail.com>
Fri, 20 Dec 2013 17:41:46 +0000 (10:41 -0700)
emacs-web-server.el

index dc8188b5d8e2bbb0abf775f77e3b0da7c98b875f..2ceaf39533a80d77fb44decae51bcc81fcca7e5c 100644 (file)
@@ -101,11 +101,17 @@ function.
   (mapc #'delete-process (append (mapcar #'car (clients server))
                                  (list (process server)))))
 
   (mapc #'delete-process (append (mapcar #'car (clients server))
                                  (list (process server)))))
 
+(defvar ews-http-common-methods '(GET HEAD POST PUT DELETE TRACE)
+  "HTTP methods from http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html.")
+
+(defvar ews-http-method-rx
+  (format "^\\(%s\\) \\([^[:space:]]+\\) \\([^[:space:]]+\\)$"
+          (mapconcat #'symbol-name ews-http-common-methods "\\|")))
+
 (defun ews-parse (proc string)
   (cl-flet ((to-keyword (s) (intern (concat ":" (upcase (match-string 1 s))))))
     (cond
 (defun ews-parse (proc string)
   (cl-flet ((to-keyword (s) (intern (concat ":" (upcase (match-string 1 s))))))
     (cond
-     ((string-match
-       "^\\(GET\\|POST\\) \\([^[:space:]]+\\) \\([^[:space:]]+\\)$" string)
+     ((string-match ews-http-method-rx string)
       (list (cons (to-keyword (match-string 1 string)) (match-string 2 string))
             (cons :TYPE (match-string 3 string))))
      ((string-match "^\\([^[:space:]]+\\): \\(.*\\)$" string)
       (list (cons (to-keyword (match-string 1 string)) (match-string 2 string))
             (cons :TYPE (match-string 3 string))))
      ((string-match "^\\([^[:space:]]+\\): \\(.*\\)$" string)