Documentation
¶
Overview ¶
Package githttp serves git clone and fetch over smart HTTP, protocol version 2 only, anonymously and for public repositories only (gitprotocol-http, gitprotocol-v2).
Two requests exist: GET <repo>/info/refs?service=git-upload-pack, which answers the capability advertisement, and POST <repo>/git-upload-pack, which answers one command request (stateless-rpc). Push, the dumb protocol and protocol versions 0 and 1 are refused with a message that says so.
A repository that does not exist and one the caller may not read both answer 404, so a name cannot be probed. gitprotocol-http asks for 403 when the repository exists and is not permitted; that is a deliberate departure.
Index ¶
Constants ¶
const ( // MaxPathLen is the longest request path read at all. MaxPathLen = 512 // DefaultMaxBody bounds a request body as it travels (compressed or not). DefaultMaxBody = 8 << 20 )
Bounds that are not configurable.
Variables ¶
var ErrRoute = errors.New("no such resource")
ErrRoute is returned for a path that is none of the endpoints.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint int
Endpoint is the part of a request path after the repository.
The endpoints a request path may end in.
type Handler ¶
type Handler struct {
Repos *gitrepo.Service
Sessions *gitrepo.Limiter // keyed by client address
Log *slog.Logger
// RequestTimeout bounds one request (0: gitrepo's default).
RequestTimeout time.Duration
// MaxBody bounds a request body as sent (0: DefaultMaxBody).
MaxBody int64
}
Handler is the smart HTTP git server.