Parent
[>]
1//! Smart HTTP git protocol handlers. 2//! 3//! Provides handlers for `info/refs` (ref advertisement) and `git-upload-pack` 4//! (pack negotiation and transport), enabling `git clone` and `git fetch` over 5//! HTTP without CGI. 6//! 7//! Both handlers shell out to `git upload-pack --stateless-rpc`, following the 8//! same streaming pattern as the archive handler. 9 10use io; 11use Stdio; 12 13use GzipDecoder; 14use Body; 15use ; 16use HeaderMap; 17use header; 18use IntoResponse; 19use StreamExt; 20use Deserialize; 21use BufReader; 22use Command; 23use ; 24 25use crate; 26use crategit; 27use crate; 28 29use reaper; 30 31/// Query parameters for `info/refs`. 32 33pub 36 37/// Encodes a string as a pkt-line (4-digit hex length + payload). 38 42 43/// Handles `GET /{repo}/info/refs?service=git-upload-pack`. 44/// 45/// Returns a ref advertisement so clients can discover branches and tags before 46/// fetching. The response is a pkt-line stream with a `# service=git-upload-pack` 47/// header, followed by the output of `git upload-pack --stateless-rpc --advertise-refs`. 48pub async 109 110/// Handles `POST /{repo}/git-upload-pack`. 111/// 112/// Processes a pack-request body (wants / haves) and streams back the generated 113/// pack file. The response is a pkt-line stream with status/progress messages 114/// in band 2 and pack data in band 1. 115/// 116/// The request body is streamed through an optional gzip decoder directly into 117/// the child process's stdin — no single buffer holds the entire payload. 118pub async 206 207 208