mirror of
https://github.com/vale981/lack
synced 2025-03-04 17:01:41 -05:00
Use circular-streams for wrapping raw-body.
This commit is contained in:
parent
4e3dd0b4a8
commit
3940e86e8e
2 changed files with 12 additions and 6 deletions
|
@ -9,5 +9,6 @@
|
|||
:license "LLGPL"
|
||||
:depends-on (:quri
|
||||
:http-body
|
||||
:circular-streams
|
||||
:cl-ppcre)
|
||||
:components ((:file "src/request")))
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
:url-decode-params)
|
||||
(:import-from :http-body
|
||||
:parse)
|
||||
(:import-from :circular-streams
|
||||
:make-circular-input-stream)
|
||||
(:import-from :cl-ppcre
|
||||
:split)
|
||||
(:export :request
|
||||
|
@ -79,13 +81,16 @@
|
|||
(quri:url-decode-params query-string :lenient t))
|
||||
(rplacd (last env) (list :query-parameters query-parameters))))
|
||||
|
||||
;; POST parameters
|
||||
(with-slots (body-parameters raw-body content-length content-type) req
|
||||
(when (and (null body-parameters)
|
||||
raw-body)
|
||||
(setf body-parameters
|
||||
(http-body:parse content-type content-length raw-body))
|
||||
(rplacd (last env) (list :body-parameters body-parameters))))
|
||||
(when raw-body
|
||||
(setf raw-body (make-circular-input-stream raw-body))
|
||||
|
||||
;; POST parameters
|
||||
(when (null body-parameters)
|
||||
(setf body-parameters
|
||||
(http-body:parse content-type content-length raw-body))
|
||||
(file-position raw-body 0)
|
||||
(rplacd (last env) (list :body-parameters body-parameters)))))
|
||||
|
||||
(setf (request-env req) env)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue