This commit is contained in:
Hubert
2021-07-13 14:44:14 +02:00
parent 439e9546e7
commit f007c47dbb
2 changed files with 14 additions and 13 deletions

View File

@@ -32,6 +32,7 @@ use actix_web::web::{Buf, Bytes};
use actix_web::http::header::IntoHeaderValue;
use actix_web::client::PayloadError;
use crate::reader::ToStream;
use crate::writer::Writer;
#[derive(Template)]
#[template(path = "hello.html")]
@@ -174,13 +175,8 @@ async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Pa
let mut p: Child = cmd.spawn()?;
//p.stdin.take().unwrap().write()
let mut input = p.stdin.take().unwrap();
payload.try_for_each(|bytes| {
// println!("{:?}", bytes);
let write_all = input.write_all(bytes.bytes());
let res = write_all.map_err(|e| actix_web::client::PayloadError::Io(e));
return res;
// future::ready(Ok(()))
}).await;
let mut writer = Writer(input);
payload.try_for_each(|bytes| writer.write(bytes)).await; // le faire au niveau de payload et pas de input
println!("input sent");
let mut rdr = tokio::io::BufReader::new(p.stdout.take().unwrap());