push OK, clone KO

This commit is contained in:
Hubert 2021-07-08 08:32:23 +02:00
parent e6ff105b17
commit ee1efbe8aa
1 changed files with 3 additions and 1 deletions

View File

@ -125,6 +125,7 @@ async fn git_main(web::Path((owner, reponame)): web::Path<(String, String)>, web
}
//#[get("/git/{owner}/{repo}.git/{path:.*}")]
async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Path<(String, String)>, mut req: HttpRequest) -> io::Result<HttpResponse>{
println!("enter git_proto");
let mut cmd = Command::new("git");
cmd.arg("http-backend");
@ -154,6 +155,7 @@ async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Pa
input.write(bytes.bytes());
future::ready(Ok(()))
}).await;
println!("input sent");
//io::copy(&mut req.take_payload(), &mut p.stdin.take().unwrap())?;
// Parse the headers coming out, and the pass through the rest of the
// process back down the stack.
@ -201,7 +203,7 @@ async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Pa
let mut body = Vec::new();
rdr.read_to_end(&mut body)?;
println!("{}", String::from_utf8(body.clone()).expect("bad utf8"));
// println!("{}", String::from_utf8(body.clone()).expect("bad utf8"));
return Ok(builder.body(body));
}