Re: [Chicken-users] Code for parsing multipart/form-data
On Tue, Sep 20, 2011 at 08:49:24AM +0530, Santosh Rajan wrote: > Hi, > > I am looking for chicken code for parsing multipart/form-data. Can anyone > point me to the code please? Sure it must be there somewhere, at least in > the web server code. Unfortunately there isn't any currently because it's something nobody has needed yet, and doing this properly and elegantly is not easy. There was a "http-form-posts" egg which used a port of Gauche's MIME code for Chicken 3 which is still available from svn at https://anonym...@code.call-cc.org/svn/chicken-eggs/release/3/http-server-form-posts And Alex Shinn's "hato" library also includes some MIME handling code you might want to use: http://synthcode.com/scheme/hato (note that the link to the docs are wrong, they should point to http://synthcode.com/scheme/hato/doc/hato-manual.html) The latest release of the http-client egg (v0.5, released a few days ago) contains some hacky code to deal with multipart form posts, though. Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Code for parsing multipart/form-data
On Tue, Sep 20, 2011 at 4:10 PM, Peter Bex wrote: > > And Alex Shinn's "hato" library also includes some MIME handling code > you might want to use: http://synthcode.com/scheme/hato > (note that the link to the docs are wrong, they should point to > http://synthcode.com/scheme/hato/doc/hato-manual.html) The link from http://synthcode.com/scheme/hato/ is correct. I don't know where you found the link without the trailing slash, but if you navigate from the top page all the links should work. [I should change the bad link to a redirect though.] -- Alex ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Code for parsing multipart/form-data
Thanks all, for the links, will look into them. On Tue, Sep 20, 2011 at 12:40 PM, Peter Bex wrote: > On Tue, Sep 20, 2011 at 08:49:24AM +0530, Santosh Rajan wrote: > > Hi, > > > > I am looking for chicken code for parsing multipart/form-data. Can anyone > > point me to the code please? Sure it must be there somewhere, at least in > > the web server code. > > Unfortunately there isn't any currently because it's something nobody > has needed yet, and doing this properly and elegantly is not easy. > > There was a "http-form-posts" egg which used a port of Gauche's MIME > code for Chicken 3 which is still available from svn at > > https://anonym...@code.call-cc.org/svn/chicken-eggs/release/3/http-server-form-posts > > And Alex Shinn's "hato" library also includes some MIME handling code > you might want to use: http://synthcode.com/scheme/hato > (note that the link to the docs are wrong, they should point to > http://synthcode.com/scheme/hato/doc/hato-manual.html) > > The latest release of the http-client egg (v0.5, released a few days ago) > contains some hacky code to deal with multipart form posts, though. > > Cheers, > Peter > -- > http://sjamaan.ath.cx > -- > "The process of preparing programs for a digital computer > is especially attractive, not only because it can be economically > and scientifically rewarding, but also because it can be an aesthetic > experience much like composing poetry or music." >-- Donald Knuth > -- http://about.me/santosh.rajan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Code for parsing multipart/form-data
Hi Jules, Jules Altfas writes: > A tarball of the code is available at: > http://webserv.bmedctr.com. There's not a whole lot of documentation, > though the code is pretty straightforward and commented. The site has > more info. interesting! It would be nice to have an egg for at least the MIME parser part. For that to be usable with Spiffy it would have to be changed to read from normal Scheme ports but that shouldn't be too hard. If you don't want to do it yourself I might look into it! Moritz ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Code for parsing multipart/form-data
Moritz, Thanks for your interest in using the web server's mime-parsing module. I thought I should clarify a few points about what I've done, just in case there are questions :) 1) The mime-parse module makes use of two modules: common and IOport. Common is a collection of aliases, and utility functions. The common module definitely needs cleanup, but as far as mime-parse goes, most of common can be ignored. Use of aliases is optional. I "invented" the shorter forms because typing on the keyboard is difficult for me, so shortcuts are useful. My aim was making them short but not too cryptic. I tried to not mimic K. 2) I've been long planning to factor out all the gnutls-related stuff into a separate module, and organize it so it can be compiled in optionally. Not very hard to do, just haven't yet gotten to it since, up to now, this had been a personal project. I thought the mime-parse module might be useful, and since it didn't use gnutls, wrongly didn't give it much attention. The reason I used gnutls at all, vs. openssl, was that I was familiar with gnutls and knew it was adaptable to my purpose. To support https, I needed to have i/o that would work with either standard socket calls, or equivalent gnutls calls. This lead to the development of IOport (see below), which transparently handles either type of transmission (that is, encrypted or not) in a port-like way. openssl is a BSD alternative to gnutls I need to learn to use; I still plan to do that. The API's are different--I just have to work on it. 3) IOport module was a solution to two problems, https, and mime-parsing within http, i.e., finding text data in binary input, and to be able to do so transparently across https, http, files, string data. Since using low level C i/o API was quite familiar to me, it was most straightforward to develop i/o facilities to do what I needed, then create the Scheme interface that provides higher level functionality. The most important procedure in IOport wrt mime-parsing is (read-to-bnd ...) (reads binary input until reaching a string boundary). In keeping with its task, the procedure is a little convoluted. Nonetheless, it may not be too difficult to convert to regular in/out ports, though I vaguely remember having some problems with buffering or timeouts when I tried this before. (That was a couple of years ago--things may have changed.) Another issue with regular ports is whether they will work with https, if that is important. 4) The server also has pgsql modules that don't wrap the C pgsql library but rather send/receive "frontend/backend" protocol messages via socket connection to a pgsql server. The method works well for database access, however potential for pgsql code to be portable across scheme implementations is still a goal to be reached. The server is a work in progress, but even so makes clear the merit of Chicken Scheme. After all, with modest effort, it's possible to construct applications which are not only unique, even surprising, but also efficient and reliable. In the realm of programming what could be better? Thanks Jules ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Code for parsing multipart/form-data
On Sep 20 2011, Santosh Rajan wrote: Hi, I am looking for chicken code for parsing multipart/form-data. Can anyone point me to the code please? Sure it must be there somewhere, at least in the web server code. There is also at http://ball.askemos.org/InstallResources the Code for Askemos. It's maintained. (Runs at all the servers of askemos.org at this moment 3 hosts with Chicken and 3 with RScheme.) You will need both (still at this time), the RScheme tarball (which contains the R5RS code too) and the chicken port (chicken specific code only). For the MIME parser and serialiser see the directory mechanism/notation. See http://ball.askemos.org/BALLFeatures to get an idea what is in the other directories. (Note that the HTTP/S server/client implementation might look a bit strange; not only has it been grown over time to run on two different Schemes, since it runs in a p2p environment, it needs to be careful to maintain resources and watch timeouts all the time. On top of that it supports some magic to "reverse" connections, where the "client" - which has opened the network connection - will act as server wrt. HTTP.) Best regards /Jörg ... ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Code for parsing multipart/form-data
Hi Jörg, Jörg F. Wittenberger writes: > There is also at http://ball.askemos.org/InstallResources > the Code for Askemos. It's maintained. (Runs at all the servers of > askemos.org at this moment 3 hosts with Chicken and 3 with RScheme.) > > You will need both (still at this time), the RScheme tarball > (which contains the R5RS code too) and the chicken port (chicken > specific code only). thanks a lot! However, the link to the chicken port's tarball appears to be broken. Moritz ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Code for parsing multipart/form-data
On Sep 22 2011, Moritz Heidkamp wrote: Hi Jörg, Jörg F. Wittenberger writes: There is also at http://ball.askemos.org/InstallResources the Code for Askemos. It's maintained. (Runs at all the servers of askemos.org at this moment 3 hosts with Chicken and 3 with RScheme.) You will need both (still at this time), the RScheme tarball (which contains the R5RS code too) and the chicken port (chicken specific code only). thanks a lot! However, the link to the chicken port's tarball appears to be broken. Thanks for reporting, that's indeed been the case!. /Jörg ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users