Plasma GitLab Archive
Projects Blog Knowledge

Programming with Objective Caml Document Tree


Download Ocamlnet
Download Findlib
RFC 2616 (HTTP specification)
RFC 2617 (HTTP authentication)
RFC 959 (FTP specification)

    This is the archived Netclient page. The new homepage can be found here!


This component, part of Ocamlnet, currently contains a client for the HTTP 1.0 and 1.1 protocols, as well as a client for FTP and Telnet.

The HTTP client

The client is HTTP 1.1-compliant which means that it implements enough of HTTP 1.1 in order to be able to communicate with any HTTP 1.1 or 1.0 server. It is simple to use, there is a convenience function that handles the whole request and the whole reply, and you need only to pass the URL to the function, and it returns the received document. It is also possible to send customized requests to the server, i.e. you can add header lines for example to get the document under a certain condition.

The HTTP client is an advanced implementation which not only masters the minimal request/reply scheme but also the more sophisticated protocol features such as:

  • Persistent connections: The TCP connection between the client and the server is not closed after one request/reply round, but it can be reused for the next access to the same server. This improves the performance.

  • Pipelining: The efficient pipelining mode reduces the network overhead.

  • Chunked messages: This feature allows servers to use persistent connections also for dynamically generated contents for which the length of the message is not known when the message headers are sent.

  • Authentication: The client handles the details of authentication. Both the "basic" and "digest" authentication schemes are supported.

  • Redirections: For GET and HEAD requests, redirections indicated by the return codes 301 and 302 are performed automatically.

  • Proxies: Instead of connecting to the server directly it is also possible to contact a proxy.

  • Multiplexing: The whole client uses multiplexing to access the sockets, and because of this, one can run several clients concurrently without needing multi-threading.

The client does not implement all features of HTTP 1.1; in particular multipart messages are currently left out. Note that this feature is optional, i.e. its absence does not break the compatibility with the protocol.

The FTP client

The FTP client is not yet ready for "production" use. Although most of the protocol is implemented, some important features are missing (e.g. uploading files), and there are also issues, especially the exception handling does not work yet as specified. Nevertheless, it is stable enough to experiment with it. As the HTTP client, it supports concurrency by multiplexing.

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml