[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)
- [elpa] 19/119: simply (name . content) for form elements, (continued)
- [elpa] 19/119: simply (name . content) for form elements, Eric Schulte, 2014/03/10
- [elpa] 21/119: helper to send a file with mime type, Eric Schulte, 2014/03/10
- [elpa] 22/119: file serving example, Eric Schulte, 2014/03/10
- [elpa] 23/119: handle close-connection thrown during header parse, Eric Schulte, 2014/03/10
- [elpa] 25/119: seems to be generally usable, added a README, Eric Schulte, 2014/03/10
- [elpa] 24/119: parse application/x-www-form-urlencoded post data, Eric Schulte, 2014/03/10
- [elpa] 26/119: thread proc through some functions, Eric Schulte, 2014/03/10
- [elpa] 28/119: testing a hello-world server, Eric Schulte, 2014/03/10
- [elpa] 27/119: run test processes asynch, Eric Schulte, 2014/03/10
- [elpa] 29/119: update examples, Eric Schulte, 2014/03/10
- [elpa] 31/119: match more HTTP methods,
Eric Schulte <=
- [elpa] 30/119: fleshed out some more tests, Eric Schulte, 2014/03/10
- [elpa] 32/119: url-encoded parameters, Eric Schulte, 2014/03/10
- [elpa] 34/119: found a confounding POST example, Eric Schulte, 2014/03/10
- [elpa] 33/119: ews-subdirectoryp convenience function, Eric Schulte, 2014/03/10
- [elpa] 36/119: bug fix, Eric Schulte, 2014/03/10
- [elpa] 35/119: cleaned up header/param parsing, Eric Schulte, 2014/03/10
- [elpa] 37/119: fixed tests, running and passing, Eric Schulte, 2014/03/10
- [elpa] 39/119: removed extra comments from examples, Eric Schulte, 2014/03/10
- [elpa] 40/119: moving around examples, Eric Schulte, 2014/03/10
- [elpa] 42/119: Makefile integration, Eric Schulte, 2014/03/10