pub struct GitHttpService { /* private fields */ }Expand description
The Git HTTP service.
Implementations§
Source§impl GitHttpService
impl GitHttpService
Sourcepub fn new(repo_root: PathBuf) -> Self
pub fn new(repo_root: PathBuf) -> Self
Build a service rooted at repo_root. All repos served must
live under this directory.
Sourcepub fn with_push_guard(self, guard: PushPathGuard) -> Self
pub fn with_push_guard(self, guard: PushPathGuard) -> Self
Install a pre-receive path guard (see crate::push_guard).
guard receives each path a push would add, change or delete, as a
repository-relative path with a leading /, and returns true to
refuse it. With a guard installed every git-receive-pack request is
inspected before the CGI runs and the whole push is refused if any
path is refused, is a symlink or submodule entry, or the push exceeds the
documented size bounds. Without one, pushes are not inspected: use this
whenever the repository working tree is served or interpreted by
anything other than git.
Sourcepub fn with_backend_path(self, path: PathBuf) -> Self
pub fn with_backend_path(self, path: PathBuf) -> Self
Override the default CGI binary path.
Sourcepub fn with_auth<A: GitAuth + 'static>(self, auth: A) -> Self
pub fn with_auth<A: GitAuth + 'static>(self, auth: A) -> Self
Plug in an authoriser. Without one, write requests still
succeed — the service becomes an anonymous-push setup, which
is the behaviour JSS uses when no handleAuth pre-hook fires.
Sourcepub fn with_auth_arc(self, auth: Arc<dyn GitAuth>) -> Self
pub fn with_auth_arc(self, auth: Arc<dyn GitAuth>) -> Self
Same as Self::with_auth but takes a pre-boxed Arc.
Sourcepub async fn handle(&self, req: GitRequest) -> Result<GitResponse, GitError>
pub async fn handle(&self, req: GitRequest) -> Result<GitResponse, GitError>
Handle an incoming Git HTTP request.