Introduction into OcamlNet
| Component "netstring"
| Component "cgi"
| General hints
RELATED
Reference Manual
|  |  | The library component "netstring" A short overview: The Netchannels module wraps I/O channels into classes. This increases the flexibility of channels a lot. Netchannels are used throughout the rest of the library. - There is also a variant called Netstream supporting an intelligent buffering that allows look-ahead. There are a number of quite low-level modules that are very useful, too. Netbuffer is an enhanced version of the Buffer module of the standard library that allows deletions within buffers. - There are two wrapper modules for regular expression engines: Netstring_str and Netstring_pcre. These have almost identical interfaces, but differ in one point. Netstring_str accepts Str-like regular expressions, while Netstring_pcre prefers the Perl/PCRE syntax. The current implementation of these modules bases on PCRE in both cases. The idea of these wrapper modules is that we can change the underlying regexp engine while retaining the old interfaces. The Netencoding modules deals with some frequently found encodings of characters: Base64, QuotedPrintable, URL-encoding, HTML-encoding. Strings can be encoded and decoded. For Base64 and QuotedPrintable it is even possible to encode or decode while reading from or writing to a netchannel. The algorithm works chunk by chunk, and thus supports large data streams. Another kind of encoding is addressed by Netconversion: This module can recode between character sets. Again, conversion can be applied to strings or netchannels. The focus of this module is conversion between character encodings, but not Unicode support. So you do not find a special data structure for Unicode strings, and you do not find functions for locales. It is just what network protocols need. One of the most important data structures are mail-style messages, also called RFC822 messages. The module Netmime supports these messages, including (as the name says) the MIME extensions. Messages are represented as classes, and can be processed in a rather convenient way. If needed, there is also the low-level Mimestring module. There are two special-purpose parsers: Netdate for date strings, and Netaddress for mail addresses. The module Netsendmail allows the composition of mails with attachments, and calling the MTA. This is very useful for daemons that want to send mail. (An SMTP implementation is still missing, though.) There is a parser and printer for HTML text: Nethtml. The HTML document is represented as recursive data type. The HTML parser can cope with errorneous HTML to a certain extent and tries to recover from errors. The parser is parameterized with a "simplified DTD" that is suffient for HTML. It is possible to use this parser for other SGML document types, as long as the simplified DTDs contain enough information to find out where elements begin and end. The module Neturl provides an abstract data type for URLs, allowing users to parse URLs, modify them, and print them. The module is known to be very strict regarding the URL syntax, but nevertheless very useful. The Netstring part of the library is now fully documented with ocamldoc. Because of this, the reference manual is the best source of information. Most important, this manual includes now a number of tutorials for the more difficult modules: Netchannels Netmime Netsendmail Neturl Netulex