[Bese-devel] Re: rfc2388
Marco Baringer
mb at bese.it
Mon Jul 17 15:53:47 UTC 2006
Lou Vanek <vanek at acd.net> writes:
> Marco Baringer wrote:
>
>> Lou Vanek <vanek at acd.net> writes:
>>
>>>if anybody out there is using clisp and needs an rfc2388 mime parser,
>>>the attached code will probably save you some time.
>> does the current parser fail on clisp?
>
> On the mime headers i get when running the upload file example,
> clisp cannot parse 'em, at least on windows. Two reasons below.
> Third reason: the stream i get from araneida (nonbuffered-character)
> is not readable via "read-byte", which is why i added the stream-reader
> function. But i still had problems with the parser, as detailed below.
yeah, araneida treats http as a text protocol. unfortunetely it is
not :(
the _solution_ is to fix araneida...btw that's where i think you
should send this patch.
> The binary parser cannot handle pure-unix line endings,
> and i believe the binary parser requires two dashes surrounding
> the boundary string.
the binary parser doesn't know what a line ending is. it can handle
CRLF sequences just fine.
> clisp coalesces <cr><nl> into just <nl> on windows unless
> you are able to drop down into reading the stream in binary,
> which i wasn't able to do. I don't think that's possible in clisp
> for some types of streams.
then we need to add an :external-format when araneida. if you're
treating the http stream as text where do you setup the character
encoding?
one of the main reasons i wrote the new rfc2388 was to deal with
non-ascii, non-utf data, i can not accept a change to rfc2388 which
breaks this.
> i think the binary parser expects the boundary to be
> both prefixed and suffixed with two dashes, but the
> mime boundary that i received didn't end with two dashes,
> and rfc2046 doesn't require it.
rfc2388 specifies two dashes on either side of the boundray as an
end-of-data marker. between parts the boundry is only prefixed by the
dashes. note that rfc2388 and rfc2046 are different standards (albeit
very similar). rfc2388 does not purport to implement rfc2046.
is there a browser out there sending rfc2046 in place of rfc2388?
(explorer right?)
> i also don't think the binary parser currently is set
> up to restrict the size of the upload.
no, but it is flexable enough to allow you do that without changing
the parser itself:
(defvar *maximum-size-limit* (- space-left-on-disk 1MB))
(read-mime binary-stream boundry
(lambda (mime-part)
(let ((counter 0))
(values (lambda (byte)
(when (< *maximum-size-limit* counter)
(error 'data-overflow))
(collect-byte-somewhere byte)
(incf counter))
(lambda (mime-part)
mime-part)))))
ucw's callback function in is ucw/src/backend/common.lisp.
--
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
-Leonard Cohen
More information about the bese-devel
mailing list