Skip to content

Commit

Permalink
[master] make sure we send the response back to the requester.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Bryant committed May 16, 2011
1 parent 52a72d6 commit b1311d1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/m2nc.lisp
@@ -1,17 +1,17 @@
(in-package :m2nc)

(defun chunk-input (handler stream)
(defun chunk-input (handler request stream)
(loop for line = (read-line stream nil)
until (eq line nil)
do (m2cl:handler-send-http-chunk handler line)))
do (m2cl:handler-send-http-chunk handler line :request request :binary-body-p t)))

(defun m2nc-input-handler (handler input-file-path content-type)
(m2cl:handler-receive handler)
(m2cl:handler-send-http-chunked handler :headers `(("Content-Type" . ,content-type)))
(cond ((eql input-file-path *default-input*) (chunk-input handler input-file-path))
((pathnamep input-file-path) (with-open-file (input-stream input-file-path)
(chunk-input handler input-stream))))
(m2cl:handler-send-http-chunked-finish handler))
(let ((request (m2cl:handler-receive handler)))
(m2cl:handler-send-http-chunked handler :headers `(("Content-Type" . ,content-type)))
(cond ((eql input-file-path *default-input*) (chunk-input handler request input-file-path))
((pathnamep input-file-path) (with-open-file (input-stream input-file-path)
(chunk-input handler request input-stream))))
(m2cl:handler-send-http-chunked-finish handler)))



Expand Down

0 comments on commit b1311d1

Please sign in to comment.