Open r13l opened 3 years ago
The following program illustrates the problem (using HUNCHENTOOT
, which ultimately calls CHUNGA:READ-LINE
):
(ql:quickload '("hunchentoot"))
(hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242))
(let ((sock (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp))
ss)
(sb-bsd-sockets:socket-connect sock #(127 0 0 1) 4242)
(setq ss (sb-bsd-sockets:socket-make-stream sock :output t :input t :buffering :none :element-type 'character :auto-close t))
(format ss "GET / HTTP/1.0~c~c" #\Return #\Newline)
(loop (write-char #\a ss)))
READ-LINE*
currently has no maximum line length, but will instead continue to read input until memory is exhausted. While this default should probably not be changed (there may very well be someone somewhere who is reading multi-gigabyte lines), it would enhance stability to allow callers of the library to specify a maximum line length: