Hi Ludo,

Thanks for responding.  I know this isn't really your 'thing' (for want
of a better word).

Quoth [email protected] (Ludovic Courtès):
>> cgi.scm currently uses the following patterns and I can't think of an
>> alternative way of doing it:
>>
>>  (let ((name-rx     (make-regexp "name=\"([^\"]*)\""))
>>        (filename-rx (make-regexp "filename=\"*([^\"\r]*)\"*"))
>>        (type-rx     (make-regexp "Content-Type: ([^\r]*)\r\n" regexp/icase))
>>        (value-rx    (make-regexp "\r\n\r\n")))
>>    ...)
>
> Can't this be applied just to the header part of the blob rather than to
> the whole blob, including binary data?

The problem is that there's no way of being sure how many header lines
will precede the (possibly) binary blob in any given part (RFC 2388).

 -----------------------------1307099961880952181245320094\x0d
 Content-Disposition: form-data; name=\"TABLE\"\x0d
 \x0d
 \x0d
 -----------------------------1307099961880952181245320094\x0d
 Content-Disposition: form-data; name=\"File-Upload\"; 
filename=\"null-char.txt\"\x0d
 Content-Type: text/plain\x0d
 \x0d
 f...@bar
 \x0d
 -----------------------------1307099961880952181245320094\x0d
 Content-Disposition: form-data; name=\"Button\"\x0d
 \x0d
 Upload\x0d
 -----------------------------1307099961880952181245320094--\x0d

Content-Disposition is mandatory, but Content-Type is optional
(defaulting to text/plain) as is Content-Transfer-Encoding, so the
"header part" of any given MIME part may be a single line or it may be
three.


Seb
-- 
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap



Reply via email to