githttp

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package githttp wires the smart-HTTP git protocol routes: info/refs + git-upload-pack + git-receive-pack. Each request shells out to canonical `git` plumbing — we don't reimplement the protocol.

This file owns the handler struct + Deps + Mounting; the route bodies live in handler_*.go and the credential resolver lives in auth.go.

Index

Constants

View Source
const DefaultMaxPushBytes int64 = 2 * 1024 * 1024 * 1024 // 2 GiB

DefaultMaxPushBytes is the spec-recommended cap.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Logger *slog.Logger
	Pool   *pgxpool.Pool
	RepoFS *storage.RepoFS
	// MaxPushBytes is the hard cap on the git-receive-pack request body.
	// Defaults to 2 GiB when zero.
	MaxPushBytes int64
}

Deps wires the git-HTTP handler set.

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers is the registered handler set. Construct via New.

func New

func New(d Deps) (*Handlers, error)

New constructs the handler set, validating Deps.

func (*Handlers) MountSmartHTTP

func (h *Handlers) MountSmartHTTP(r chi.Router)

MountSmartHTTP registers the smart-HTTP routes on r. Caller is responsible for placing this group ahead of any conflicting routes (specifically, register before the /{owner}/{repo} two-segment route from S11 — `.git` URLs would otherwise be eaten by it).

Caller is also responsible for stripping CSRF, response-compression, and request-timeout middleware from this group; see web/server.go.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL