[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 11/119: more flexible network process creation
From: |
Eric Schulte |
Subject: |
[elpa] 11/119: more flexible network process creation |
Date: |
Mon, 10 Mar 2014 16:57:01 +0000 |
eschulte pushed a commit to branch master
in repository elpa.
commit 0fa04269f6efaba83ad6e9ef8273c11a4770e486
Author: Eric Schulte <address@hidden>
Date: Wed Dec 18 14:02:50 2013 -0700
more flexible network process creation
---
emacs-web-server.el | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/emacs-web-server.el b/emacs-web-server.el
index 3830dfd..46ae4b8 100644
--- a/emacs-web-server.el
+++ b/emacs-web-server.el
@@ -29,7 +29,7 @@
(defvar ews-time-format "%Y.%m.%d.%H.%M.%S.%N"
"Logging time format passed to `format-time-string'.")
-(defun ews-start (handler port &optional log-buffer host)
+(defun ews-start (handler port &optional log-buffer &rest network-args)
"Start a server using HANDLER and return the server object.
HANDLER should be a list of cons of the form (MATCH . ACTION),
@@ -40,6 +40,9 @@ specified by KEYWORD. In either case when MATCH returns
non-nil,
then the function ACTION is called with two arguments, the
process and the request object.
+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.
@@ -66,14 +69,14 @@ function.
"
(let ((server (make-instance 'ews-server :handler handler :port port)))
(setf (process server)
- (make-network-process
+ (apply
+ #'make-network-process
:name "ews-server"
:service (port server)
:filter 'ews-filter
- :server 't
- :nowait 't
+ :server t
+ :nowait t
:family 'ipv4
- :host host
:plist (list :server server)
:log (when log-buffer
(lexical-let ((buf log-buffer))
@@ -83,7 +86,8 @@ function.
(goto-char (point-max))
(insert (format "%s\t%s\t%s\t%s"
(format-time-string ews-time-format)
- (first c) (second c) message)))))))))
+ (first c) (second c) message)))))))
+ network-args))
(push server ews-servers)
server))
- [elpa] branch master updated (f64a801 -> 4f28097), Eric Schulte, 2014/03/10
- [elpa] 02/119: logging support, Eric Schulte, 2014/03/10
- [elpa] 03/119: parsing HTTP headers, Eric Schulte, 2014/03/10
- [elpa] 01/119: initial commit, echo server working, Eric Schulte, 2014/03/10
- [elpa] 04/119: simple hello world server working, Eric Schulte, 2014/03/10
- [elpa] 05/119: stub out (but don't write any) tests, Eric Schulte, 2014/03/10
- [elpa] 08/119: NOTES file for tasks and notes, Eric Schulte, 2014/03/10
- [elpa] 07/119: TODO: handle post data, Eric Schulte, 2014/03/10
- [elpa] 06/119: helper for HTTP headers, Eric Schulte, 2014/03/10
- [elpa] 09/119: parsing form data in POST, Eric Schulte, 2014/03/10
- [elpa] 11/119: more flexible network process creation,
Eric Schulte <=
- [elpa] 10/119: some simple examples, Eric Schulte, 2014/03/10
- [elpa] 15/119: more lenient parsing of multipart forms, Eric Schulte, 2014/03/10
- [elpa] 12/119: compiling to .elc, Eric Schulte, 2014/03/10
- [elpa] 13/119: tasks, Eric Schulte, 2014/03/10
- [elpa] 18/119: 404 not found helper, Eric Schulte, 2014/03/10
- [elpa] 17/119: handling errors, Eric Schulte, 2014/03/10
- [elpa] 14/119: better requirements for test, Eric Schulte, 2014/03/10
- [elpa] 16/119: tasks, Eric Schulte, 2014/03/10
- [elpa] 20/119: don't require non-nil return to close connection, Eric Schulte, 2014/03/10
- [elpa] 19/119: simply (name . content) for form elements, Eric Schulte, 2014/03/10