fixed read-sequence type error when there are more lack middlewares

Error message: The value [NUMBER] is not of type CHARACTER when setting an element of (ARRAY CHARACTER).
Thus, the updated code checks the type of RAW-BODY to decide what to do.
This commit is contained in:
Shaka Chen 2022-08-08 23:13:35 +08:00
parent b5fd7e458a
commit e44d2b247b

View file

@ -453,8 +453,17 @@ the contents sent to the brower."
(setf post-data id)))
(when (equal (getf env :content-type)
"application/x-www-form-urlencoded")
(setf post-data (make-string (getf env :content-length)))
(read-sequence post-data (getf env :raw-body)))
(setf post-data (cond ((eq (class-name (class-of (getf env :raw-body)))
'circular-streams:circular-input-stream)
(let ((array-buffer (make-array (getf env :content-length)
:adjustable t
:fill-pointer t)))
(read-sequence array-buffer (getf env :raw-body))
(flex:octets-to-string array-buffer)))
(t
(let ((string-buffer (make-string (getf env :content-length))))
(read-sequence string-buffer (getf env :raw-body))
string-buffer)))))
(cond (long-poll-first
(let ((id (random-hex-string)))
(setf (gethash id *connection-data*) (make-hash-table* :test #'equal))