package git-http

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

HTTP helpers to implement Git's Smart-HTTP protocol.

The "smart" HTTP connection simulates a normal channel by a sequence of RPC calls (the HTTP requests and responses) by:

  • allowing a read only after a write: the write is in the HTTP request, the read is in the HTTP response.
  • replaying all the previous communication in both directions every time. The new thing to read or write is appended to the history and part of a new RPC.

This looks like a terrible idea, but in practice there are very few round-trips between the client and the server with relatively small amounts of data. These round-trips correspond to the negotiation phase, where the client and the server need to find which hashes they have in common. Once this is done, the final RPC response contains the pack file, which is where most of the data is.

The good thing with that scheme (I guess) is that the server doesn't have to keep any client state. Note: there are more clever ways to do this...

That module implements a "restartable" HTTP channel, which hides all that reconnection and replay complexity behind a regular channel interface.

module type CLIENT = sig ... end
module type CHAN = sig ... end

The module type for buildable channels (see CHAN.make).

module Flow (HTTP : CLIENT) (IC : CHAN) (OC : CHAN) : sig ... end
OCaml

Innovation. Community. Security.