Compare commits
2 Commits
7d8bfbbb62
...
08113e45fb
Author | SHA1 | Date |
---|---|---|
Hubert | 08113e45fb | |
Hubert | e4351f7217 |
18
src/main.rs
18
src/main.rs
|
@ -202,18 +202,20 @@ async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Pa
|
|||
}
|
||||
|
||||
println!("Write body...");
|
||||
let mut body = Vec::new();
|
||||
//let mut body = Vec::new();
|
||||
//rdr.bytes()
|
||||
let mut buff : [u8; 1024] = [0; 1024];
|
||||
builder.streaming(stream::repeat_with(|| {
|
||||
match rdr.read(&buff) {
|
||||
Ok(l) => {Bytes::copy_from_slice(&buff[0..l])}
|
||||
Err(_) => {}
|
||||
let response = builder.streaming(stream::repeat_with(|| {
|
||||
let mut buff : [u8; 1024] = [0; 1024];
|
||||
match rdr.read(&mut buff[..]) {
|
||||
Ok(l) => {Ok(Bytes::copy_from_slice(&buff[0..l]))}
|
||||
Err(e) => {Err(e)}
|
||||
}
|
||||
}).take_while(|bytes| {
|
||||
future::ready(bytes.is_ok())
|
||||
}));
|
||||
rdr.read_to_end(&mut body)?;
|
||||
//rdr.read_to_end(&mut body)?;
|
||||
// println!("{}", String::from_utf8(body.clone()).expect("bad utf8"));
|
||||
return Ok(builder.body(body));
|
||||
return Ok(response);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue