compile but runtime fails with "failt to parse header value"
This commit is contained in:
parent
f007c47dbb
commit
a4f4cb3033
11
src/main.rs
11
src/main.rs
|
@ -149,7 +149,7 @@ async fn git_main(web::Path((owner, reponame)): web::Path<(String, String)>, web
|
|||
GitMainTemplate { repo, browse : browse, root : path, user_opt : Some(user)}
|
||||
}
|
||||
//#[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>{
|
||||
async fn git_proto(mut 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");
|
||||
|
@ -173,10 +173,10 @@ async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Pa
|
|||
.stdout(Stdio::piped())
|
||||
.stdin(Stdio::piped());
|
||||
let mut p: Child = cmd.spawn()?;
|
||||
//p.stdin.take().unwrap().write()
|
||||
let mut input = p.stdin.take().unwrap();
|
||||
let mut writer = Writer(input);
|
||||
payload.try_for_each(|bytes| writer.write(bytes)).await; // le faire au niveau de payload et pas de input
|
||||
while let Some(Ok(bytes)) = payload.next().await {
|
||||
input.write_all(bytes.bytes()).await;
|
||||
}
|
||||
println!("input sent");
|
||||
let mut rdr = tokio::io::BufReader::new(p.stdout.take().unwrap());
|
||||
|
||||
|
@ -184,7 +184,8 @@ async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Pa
|
|||
loop {
|
||||
let mut line = String::new();
|
||||
let len = rdr.read_line(&mut line).await?;
|
||||
if line == "" || line == "\r" {
|
||||
// println!("line : \"{}\"", line);
|
||||
if line.len() == 2 {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue