Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[http] Set the content-length in the body parser and emit

"request" event from the outer fsm when the body-fsm reports :done
  • Loading branch information...
commit 9b67874ea65ad0f495debab6278e52d13ac2f05e 1 parent 6f4174f
@sshirokov authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/http/http-server.lisp
View
13 src/http/http-server.lisp
@@ -177,15 +177,20 @@
(con-len (parse-integer (or con-len "") :junk-allowed t))
(con-len (or con-len 0)))
(format t "=> Content-Length: ~S~%" con-len)
- (when (zerop con-len)
- (setf (state (body-fsm parser)) :skip)
- (emit (peer parser) "request" parser)))
+ (if (zerop con-len)
+ (progn
+ (setf (state (body-fsm parser)) :skip)
+ (emit (peer parser) "request" parser))
+ (setf (remaining (body-fsm parser)) con-len)))
(return (1+ i))))))))
(defstate request-parser :read-body (parser data)
(let ((data (or (buffer parser) data)))
(setf (buffer parser) nil)
- (format t "Body data: ~S~%" (babel:octets-to-string data))
+ (funcall (body-fsm parser) data)
+ (when (eql (state (body-fsm parser)) :done)
+ (setf (state (body-fsm parser)) :skip)
+ (emit (peer parser) "request" parser))
(values nil (buffer parser))))
;; HTTP Peer
Please sign in to comment.
Something went wrong with that request. Please try again.