1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
Netclient includes:
- A sophisticated HTTP 1.1 client (quite stable)
- A Telnet client
- An experimental FTP client
All clients are multiplexing-aware, and can be used concurrently.
The installation of the clients is "findlib"-based. "findlib" is a
simple library that organizes the installation of "packages", i.e.
collections of ocaml modules. (The client works without "findlib",
but you have to heavily modify the Makefile.)
You need the following packages:
- ocamlnet
- equeue
You find "findlib" and the packages in the Ocaml link database,
http://www.npc.de/ocaml/linkdb/
Note that there is online documentation for "findlib":
http://www.ocaml-programming.de/packages/findlib/
------------------------------------------------------------------------
Installation:
------------------------------------------------------------------------
- It is assumed that "findlib", "ocamlnet" and "equeue" are properly installed.
- Do
make all
to compile with the bytecode compiler. This creates netclient.cma
and http_client_mt.cmo, the add-on for bytecode multi-threading.
- Do
make opt
to compile with the native compiler if present. This creates netclient.cmxa,
and, if possible, http_client_mt.cmx, the add-on for native
multi-threading.
- Do
make install
to install.
- Do
make uninstall
to uninstall.
------------------------------------------------------------------------
How to link in netclient.cma:
------------------------------------------------------------------------
To link something which uses netclient.cma, use the following command
which demonstrates how to link:
ocamlfind ocamlc -o output
-package netclient -linkpkg
<your objects>
SUPPORT FOR MULTI-THREADING:
This is simply enabled by giving the -thread (or -vmthread) option, e.g.
ocamlfind ocamlc -thread -o output -package netclient -linkpkg
<your objects>
------------------------------------------------------------------------
Example:
------------------------------------------------------------------------
To run the examples in examples/simple, you need a toploop as follows:
ocamlfind ocamlmktop -o top -package unix,str -linkpkg
The other examples have Makefiles.
------------------------------------------------------------------------
New Convenience Module
------------------------------------------------------------------------
From release 0.2, there is a convenience module which simplifies the
usage of the client.
- open the module:
open Http_client.Convenience;;
- get the result in one step:
http_get "http://somewhere.com/file"
The convenience module also interprets the environment variables
http_proxy and no_proxy. Furthermore, user and password can be
given directly in the URL (http://user:password@location.domain/path).
------------------------------------------------------------------------
RESTRICTED MULTI-THREADING SAFETY
------------------------------------------------------------------------
If used in a certain way, release 0.3 of "netclient" is thread-safe.
See the comment in "http_client.mli" for details.
------------------------------------------------------------------------
Restrictions
------------------------------------------------------------------------
- Some rarely used features of HTTP/1.1 have not been implemented,
such as multipart messages.
- Some features of HTTP/1.1 are not supported by this module, but can
be implemented on top of it:
content encoding, content digests, conditional/partial GET, caching
A lot of fun!
Author:
Gerd Stolpmann, gerd@gerd-stolpmann.de
----------------------------------------------------------------------
History
----------------------------------------------------------------------
0.91: Improved HTTP API. Again rewritten most parts of Http_client.
This version solves a number of issues:
- Updated to match RFC 2617
- Large requests can be handled without performance problems.
It is possible to download into files, and to upload from
files.
- Fixed the "100 Continue" behaviour
- New authentication framework. Digest authentication is
supported as specified in RFC 2617.
- Fixed redirection behaviour
- xstr is no longer required for multi-threading
This version requires O'Caml 3.08.3 or better.
Addition of the experimental FTP client.
0.90.4: Removed dependency on the module "Cgi" (deprecated)
0.90.3: Fixing bugs in Makefile for O'Caml 3.07
0.90.2: Fixed a problem with incomplete status lines (e.g.
"HTTP/1.1 500" instead of "HTTP/1.1 500 Server Error").
0.90.1: ???
0.90: Rewritten Http_client in event-driven way.
Added Telnet_client.
|