emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 31/119: match more HTTP methods


From: Eric Schulte
Subject: [elpa] 31/119: match more HTTP methods
Date: Mon, 10 Mar 2014 16:57:11 +0000

eschulte pushed a commit to branch master
in repository elpa.

commit 9d76a3fa875abbb930350e752b88027bb9c288e8
Author: Eric Schulte <address@hidden>
Date:   Fri Dec 20 10:41:46 2013 -0700

    match more HTTP methods
---
 emacs-web-server.el |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/emacs-web-server.el b/emacs-web-server.el
index dc8188b..2ceaf39 100644
--- a/emacs-web-server.el
+++ b/emacs-web-server.el
@@ -101,11 +101,17 @@ function.
   (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
-     ((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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]