English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Announcement: ocamlnet-0.92 has been released
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-04 (18:59)
From: Gerd Stolpmann <info@g...>
Subject: [Caml-list] Announcement: ocamlnet-0.92 has been released

The ocamlnet project releases a new version of its library, the successor of
the well-known netstring library. This release mainly focuses on smoothing
the interoperation of its modules, especially by using the concept of
channel objects everywhere. There are also a number of new features, see

Ocamlnet has now a rich set of functions for the following tasks:

- Dealing with stacks of channel transformers, e.g. "read a certain section
  of a file and decode the BASE64 strings, and then convert everything
  to UTF-8". This can usually be done without allocating large buffers,
  but by processing the data block by block.

- Separate a channel into sections, and process the sections independently.
  For example, one can define a boundary string, and read a file section
  by section.

- Encode and decode strings, convert between character sets.
  (The character set conversion needs to be revised.)

- Parse and print date strings

- Parse and print HTML text

- Parse and print MIME mail messages. There are now high-level functions
  for manipulating mail messages (NEW)

- Compose mail messages and send them (using sendmail). The message
  composer creates MIME messages, too, and can deal with arbitrary 
  character sets.

- Parse and print URLs (This module is not yet up to date)

- Ocamlnet includes a complete and modularized implementation of the CGI

- Ocamlnet has experimental support for building application servers
  with Apache and the Jserv protocol

- Ocamlnet includes an experimental POP3 client

The library has been rewritten such that many functions accept so-called
netchannels (or channel objects) as input/output media. The idea is very
simple: a netchannel either represents a real channel, a buffer, a string,
a lexer buffer, a filter (or some of the more complicated entities). A
netchannel for input has methods for reading from the channel, for example

let line = ch # input_line()

to read the next line, and an output netchannel provides the usual output
methods, like

ch # output_string "xyz"

to output a string to the netchannel. The same type is used no matter
what kind of thing the netchannel really is:

let ch1 = new output_channel stdout ;;

let buf = Buffer.create 100 ;;
let ch2 = new output_buffer buf ;;

Here, ch1 is a netchannel on top of O'Caml's built-in out_channel, and
ch2 is on top of a buffer. Ocamlnet contains many functions that can be
applied to any kind of netchannel, for example

write_mime_message msg ch1 msg    (* write msg to stdout *)
write_mime_message msg ch2 msg    (* write msg to the buffer buf *)

This helps a lot because it saves the programmer from providing the
same functionality for various data types.

A more complicated netchannel is

let ch3 = new output_filter (new Base64.encoding_pipe()) ch2 ;;

Any output to ch3 is BASE64-encoded and transferred to ch2. The netchannels
can be stacked without any restriction, and if the stack is not too high,
the performance loss is quite minimal. For instance, the BASE64 encoding 
is applied block by block, so that the additional costs for method lookups
must only be paid for a whole block, not for a single byte.

Another interesting means of programming are the so-called netstreams.
These are input channels with look-ahead, i.e. you can look at the
bytes you will read in the future. The look-ahead buffer can by enlarged
as needed. It is possible to form substreams of netstreams, in order to
view only a certain section of the whole stream. The substream will return
EOF where the section ends, but the main stream can of course read beyond
the section boundary. (See Netstream.) Again, it is possible to recursively
apply substreaming to itself. An application is the parser for nested
multipart MIME messages.

Netchannels and netstreams are two examples illustrating the current
direction of Ocamlnet development. We are trying to find out the basic
types that are needed everywhere, and that make up the glue between
the various parts of the library. 

And before I forget it the second time: Ocamlnet includes a routine to
translate Str regular expressions to Pcre regular expressions (because
we are only using Pcre now).

Ocamlnet can be found here:
- Project page: http://sourceforge.net/projects/ocamlnet
- Home page: http://ocamlnet.sourceforge.net
- Download of release 0.92:

If you want to join the Ocamlnet developers team, please subscribe to the
ocamlnet mailing list, and describe what you want to contribute.
(More information on the project page.)

Enjoy it,

Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 45             
64293 Darmstadt     EMail:   gerd@gerd-stolpmann.de
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr