INTRODUCTION ------------ This package contains the source for the small OCamlHTML library. This library allows you to write CGI programs purely in OCaml. Using this library, you program can retrieve CGI arguments (using POST, GET and multipart POST methods) and emit a HTML page as a result. You can also set/get HTTP cookies. This library needs OCaml 3.0 at least to compile http://pauillac.inria.fr/ocaml/ It makes some use of the new "optional argument" feature of OCaml 3.0. WARNING This library is experimental and not yet fully functional. And it probably contains several billions bugs. This library was only tested on a Sparc Solaris system with the Apache web server (www.apache.org) and Netscape Navigator 4.76 (www.netscape.com). It is not known whether it works on other systems (it heavily uses features in the Unix library, which may not be implemented everywhere). PACKAGE ------- Files are: - 00README this file - the library: . cgi.* CGI interface . date.* RFC 1123 date manipulation . html.* emit HTML code for web pages and forms . http.* emit HTTP header for web pages / files transfer . sscookie.* server-side cookies - server: . sserver.ml CGI server that answers requests generated by sscookies . ssclean.ml clean out-datted cookies (put in your cron table) - example: . essai.ml dumb example HOW TO COMPILE -------------- You need OCaml 3.0 to compile this library http://pauillac.inria.fr/ocaml/ First, run "./configure". You may have to specify the location of OCaml libraries (where the library will be installed) using the "--with-ocaml=" option of configure. Then, run "make; make install". The library will be installed in your OCaml directory, its name is html.cmx(a). The example and the cookie server are also compiled, but not installed. DOCUMENTATION ------------- There is now support for OCamlDOC in the sources ( http://pauillac.inria.fr/~guesdon/Tools/ocamldoc/ocamldoc.html ). So you have pretty-printed and well-commented .mli files in the doc/ directory. You can also take a look at the examples. SERVER-SIDE COOKIES ------------------- Server-side cookies is an experimental feature. It means that, when invoked, your CGI script can create files and store them on the server (in a temp file). The web page output by the CGI cript can reference these files using a URL that invoke the sserver program to get the file back (so you must get the sserver program in your CGI path). It is the client's responsability to call clean_cookies from time to time to destroy outdatted cookies. You may also want to put the ssclean program in your cron table. This is experimental and may not work properly. It may lead to security problems! RELATED ------- Jerome Feret uses this OCamlHTML library to present his Pi-calculus analyser Pi-s.a.III, itself written in OCaml. http://www.di.ens.fr/~feret/prototypes/prototypes.html What to read about HTML, HTTP and CGI: . RFC 2616 HTTP/1.1 (ftp://ftp.isi.edu/in-notes/rfc2616.txt) . RFC 1123 Internet date manipulation . RFC 2396 URI . RFC 2112 MIME mupltipart . http://www.w3.org/MarkUp/ HTML markup language Other OCaml library that do related things: . ocamlcgi http://www.lri.fr/~filliatr/ftp/ocaml/cgi/ (OLD) . OCamlNet http://sourceforge.net/projects/ocamlnet . HTMLgen http://pauillac.inria.fr/cdk/doc/htmlgen.html Everybody uses the Perl5 CGI library http://stein.cshl.org/WWW/software/CGI/cgi_docs.html This library was thought as a OCaml replacement for this library. *** LAST NOTE *** *** Now, OCamlNet (formerly Netstring) includes improved CGI *** functionnalities. *** I guess, this means the OCamlHTML library is now longer useful :( AUTHOR ------ Antoine Mine' http://www.di.ens.fr/~mine mine@di.ens.fr You can freely use and redistribute this library. You can also modify this library as long as you maintain this file and the name of the original author in each file. This is an highly experimental and scholar implementation. The author is not responsible for any damage the library can do to your computer or you brain! Copyright (C) 2000 Antoine Mine'