[hunchentoot-devel] chunked encoding for input
Cyrus Harmon
ch-tbnl at bobobeach.com
Sat Jun 28 00:02:15 UTC 2008
On Jun 27, 2008, at 4:46 PM, Edi Weitz wrote:
> On Fri, 27 Jun 2008 16:34:44 -0700, Cyrus Harmon <ch-tbnl at bobobeach.com
> > wrote:
>
>> The following patch fixes the case where one sends chunked data to a
>> hunchentoot server with, say, a PUT request. We weren't paying
>> attention to the transfer-encoding in get-post-data.
>
> Thanks for catching that. This is essentially what is already done in
> process-request, but due to the refactoring Hans and I did it happens
> too late at that point.
>
> I think get-post-data is not the right place for this, though.
> Switching chunking on or off should happen "one level further up" so
> to say. I'll try to fix this over the weekend.
Ah, right. I see that it's the fact that this is an initarg to the
request object that then gets passed to process-request that makes
this tricky.
One hacky fix is to do:
--- server.lisp (revision 3371)
+++ server.lisp (working copy)
@@ -500,7 +500,8 @@
(when (member "chunked" transfer-encodings :test
#'equalp)
;; turn chunking on before we read the request body
(setf *hunchentoot-stream* (make-chunked-stream
*hunchentoot-stream*)
- (chunked-stream-input-chunking-p *hunchentoot-
stream*) t))))
+ (chunked-stream-input-chunking-p *hunchentoot-
stream*) t
+ (slot-value request 'content-stream)
*hunchentoot-stream*))))
(let* ((*request* request)
backtrace)
(multiple-value-bind (body error)
>> Also, we should support looking for both "chunked" and "Chunked", so
>> I use string-equal instead of equalp here.
>
> equalp already does that... :)
d'oh!
thanks,
Cyrus
More information about the Tbnl-devel
mailing list