<div dir="ltr">The problem is that RFC2388:READ-UNTIL-NEXT-BOUNDARY doesn't know about the content-length as hunchentoot package doesn't pass this parameter to the rfc2388:parse-mime function. So again it should be changed in two different packages.<br>
When I implemented file upload progress bar, I had to modify the hunchentoot and rfc2388 since only hunchentoot knows about content-length and only rfc2388 knows how many bytes was read from the stream. Using these two parameters we can calculate the percentage of the data that was uploaded to the server.<br>
I could retrieve the content-length to the client via ajax and do something in javascript to disrupt the upload, but I doesn't look like a good solution to me.<br>So, my question is where and how in hunchentoot I can raise an error so that it would get propagated to the handler of the file upload request so that I can show it to the user. In the request constructor (defmethod initialize-instance ...) the body is wrapped into handler-case so any error which occurs in it should be trapped by (error (cond) ...), right? For some reason the error that I raise when the content-length is greater than some number, this error gets trapped by the lisp debugger, not by (error (cond) ...). Anyway, time for me to go back study lisp manuals! :)<br>
<br>Andrew<br><br><div class="gmail_quote">On Sun, Sep 14, 2008 at 3:14 AM, Hans Hübner <span dir="ltr"><<a href="mailto:hans@huebner.org">hans@huebner.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Sun, Sep 14, 2008 at 00:55, Andrei Stebakov <<a href="mailto:lispercat@gmail.com">lispercat@gmail.com</a>> wrote:<br>
> I wonder what's the best way to handle the case when a user tries to upload<br>
> a very large file.<br>
> Basically we need to stop execution before it gets to the<br>
> parse-rfc2388-form-data and report the problem to the user.<br>
</div>>[...]<br>
<div class="Ih2E3d">> Another thing, it's a dirty hack, what's the better way of doing this?<br>
<br>
</div>I would fix the problem in RFC2388:READ-UNTIL-NEXT-BOUNDARY. This<br>
function should read the data directly to the stream provided, and it<br>
should have a special variable (in the RFC2388 package) that can be<br>
set to limit the maximum number of bytes read.<br>
<br>
-Hans<br>
_______________________________________________<br>
tbnl-devel site list<br>
<a href="mailto:tbnl-devel@common-lisp.net">tbnl-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/mailman/listinfo/tbnl-devel" target="_blank">http://common-lisp.net/mailman/listinfo/tbnl-devel</a><br>
</blockquote></div><br></div>