[plt-scheme] CGI/multipart MIME

From: Paul Graunke (ptg at ccs.neu.edu)
Date: Mon Mar 22 23:31:33 EST 2004

If you are asking about file uploads via forms, the PLT Scheme Web 
server
in the web-server collection handles form uploads.  I guess I should 
have
peeled the form parsing goo off into another module.  Sorry.
The function read-mime-multipart in web-server-unit.ss or some code
around that probably does what you want.

Also, it looks like the mime.plt and qp.plt collections that used
to be distributed separately from
   http://www.cs.utah.edu/plt/develop/
are now included.  I ended up writing my own, though....

If you do manage to extract the functionality you need from
any of the above sources, you might want to share your findings.
Maybe the current maintainer of the web-server collection will
integrate the refactoring.

Okay, okay, I should be a bit more helpful.  I've attached a module
with just the read-mime-multipart function extracted.  I tested it
in the repl with the attached html form. (Yes, it's missing a head
and title. Whatever.)  The argument named "boundary" comes from
the content-type header.  See the servlet-content-producer
function in web-server-unit.ss if you get stuck on extracting the
boundary from the header.

Good luck!

Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multipart-mime.ss
Type: application/text
Size: 3567 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20040322/797ccc01/attachment.bin>
-------------- next part --------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20040322/797ccc01/attachment.html>
-------------- next part --------------

On Monday, March 22, 2004, at 02:30 PM, Matt wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>
> Hello all,
>
> Apologies for asking a question that doesn't even indirectly involve
> 'letrec'.
>
> What is the recommended way to handle multipart MIME documents that are
> HTTP POSTed to a PLT Scheme CGI?
>
> I gather that (lib "cgi.ss" "net") chokes on them; should I just
>
> (let ([mesg (mime-analyze (current-input-port))])
>   ...)
>
> somewhere at the top of my script? So far, I haven't found any content  
> in
> my resulting message structure, but I probably still haven't found  
> where,
> say, a name and value pair live in this regime.
>
> Pointers to the obvious are welcome. CC:'d replies are great as well,  
> as I
> ingest the digest version of this list.
>
> Thanks,
> Matt
>
> _______________________________________________________________________ 
> _
> Matt Jadud                              
> http://www.cs-ed.org/blogs/mjadud/
> Canterbury Weather: High 46 F / 8 C, Low 33 F / 1 C, Light rain shower  
> (Day)

Posted on the users mailing list.