[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 34/119: found a confounding POST example
From: |
Eric Schulte |
Subject: |
[elpa] 34/119: found a confounding POST example |
Date: |
Mon, 10 Mar 2014 16:57:12 +0000 |
eschulte pushed a commit to branch master
in repository elpa.
commit 2ba0858ec24983028ce8379afd7a1f7df9d01739
Author: Eric Schulte <address@hidden>
Date: Sat Dec 21 07:48:37 2013 -0700
found a confounding POST example
---
emacs-web-server-test.el | 37 +++++++++++++++++++++++++++++++++++++
emacs-web-server.el | 2 ++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/emacs-web-server-test.el b/emacs-web-server-test.el
index 670878f..ad56ffb 100644
--- a/emacs-web-server-test.el
+++ b/emacs-web-server-test.el
@@ -125,3 +125,40 @@ Content-Disposition: form-data; name=\"name\"
(should (string= (cdr (assoc "date" headers))
"Wed Dec 18 00:55:39 MST 2013"))))
(ews-stop server))))
+
+(ert-deftest ews/parse-another-post-data ()
+ "This one from an AJAX request."
+ (let ((server (ews-start nil ews-test-port))
+ (client (make-instance 'ews-client))
+ (header-string "POST /complex.org HTTP/1.1
+Host: localhost:4444
+User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:26.0) Gecko/20100101
Firefox/26.0
+Accept: */*
+Accept-Language: en-US,en;q=0.5
+Accept-Encoding: gzip, deflate
+DNT: 1
+Content-Type: application/x-www-form-urlencoded; charset=UTF-8
+X-Requested-With: XMLHttpRequest
+Referer: http://localhost:4444/complex.org
+Content-Length: 78
+Cookie: __utma=111872281.1462392269.1345929539.1345929539.1345929539.1
+Connection: keep-alive
+Pragma: no-cache
+Cache-Control: no-cache
+
+org=-+one%0A-+two%0A-+three%0A-+four%0A%0A&beg=646&end=667&path=%2Fcomplex.org"))
+ (unwind-protect
+ (progn
+ (ews-do-filter (process server) client header-string)
+ (let ((headers (cdr (headers client))))
+ (should (string= (cdr (assoc "path" headers)) "complex.org"))
+ (should (string= (cdr (assoc "beg" headers)) "64"))
+ (should (string= (cdr (assoc "end" headers)) "667"))
+ (should (string= (cdr (assoc "org" headers))
+ "- one
+- two
+- three
+- four
+
+"))))
+ (ews-stop server))))
diff --git a/emacs-web-server.el b/emacs-web-server.el
index 2a176fd..509e9c7 100644
--- a/emacs-web-server.el
+++ b/emacs-web-server.el
@@ -152,6 +152,8 @@ function.
(setq clients (assq-delete-all proc clients))
(delete-process proc)))))
+;; TODO: content-type should switch from escaping on double \r\n, to
+;; parsing multipart data on double \r\n
(defun ews-do-filter (proc client string)
"Return non-nil when finished and the client may be deleted."
(with-slots (leftover boundary headers) client
- [elpa] 23/119: handle close-connection thrown during header parse, (continued)
- [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, 2014/03/10
- [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 <=
- [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
- [elpa] 44/119: note, Eric Schulte, 2014/03/10
- [elpa] 43/119: more, Eric Schulte, 2014/03/10
- [elpa] 41/119: including examples in documentation, Eric Schulte, 2014/03/10