save
This commit is contained in:
parent
97ebae11f8
commit
4eb34b8060
|
@ -1,2 +1,2 @@
|
|||
target
|
||||
/target
|
||||
Cargo.lock
|
26
src/main.rs
26
src/main.rs
|
@ -18,6 +18,9 @@ use crate::ite::SuperIterator;
|
|||
use std::ops::Add;
|
||||
use std::path::{PathBuf, Path};
|
||||
use serde::Deserialize;
|
||||
use std::process::{Command, Stdio};
|
||||
use actix_web::http::header;
|
||||
use std::io;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "hello.html")]
|
||||
|
@ -117,6 +120,29 @@ async fn git_main(web::Path((owner, reponame)): web::Path<(String, String)>, web
|
|||
}
|
||||
//#[get("/git/{owner}/{repo}.git/{path:.*}")]
|
||||
async fn git_proto(web::Path((owner, reponame)): web::Path<(String, String)>, req: HttpRequest) -> impl Responder{
|
||||
let mut cmd = Command::new("git");
|
||||
cmd.arg("http-backend");
|
||||
|
||||
// Required environment variables
|
||||
cmd.env("REQUEST_METHOD", req.method().as_str());
|
||||
cmd.env("GIT_PROJECT_ROOT", "/home/hubert/test.git");
|
||||
cmd.env(
|
||||
"PATH_INFO",
|
||||
if req.path().starts_with('/') {
|
||||
req.path().to_string()
|
||||
} else {
|
||||
format!("/{}", req.path())
|
||||
},
|
||||
);
|
||||
cmd.env("REMOTE_USER", "");
|
||||
//cmd.env("REMOTE_ADDR", req.remote_addr().to_string());
|
||||
cmd.env("QUERY_STRING", req.query_string().unwrap_or_default());
|
||||
//cmd.env("CONTENT_TYPE", header(req, header::CONTENT_TYPE));
|
||||
cmd.stderr(Stdio::inherit())
|
||||
.stdout(Stdio::piped())
|
||||
.stdin(Stdio::piped());
|
||||
let mut p = cmd.spawn()?;
|
||||
io::copy(&mut req.body(), &mut p.stdin.take().unwrap())?;
|
||||
"not yet implemented"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue