try debug

This commit is contained in:
Hubert 2021-07-08 08:48:04 +02:00
parent ee1efbe8aa
commit 04b8b43343
1 changed files with 9 additions and 3 deletions

View File

@ -26,6 +26,7 @@ use std::io::{Read, BufRead, Write, ErrorKind};
use futures::{StreamExt, TryStreamExt, future};
use actix_web::web::Buf;
use actix_web::http::header::IntoHeaderValue;
use futures::stream;
#[derive(Template)]
#[template(path = "hello.html")]
@ -181,14 +182,16 @@ async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Pa
.push(value.to_string());
}
println!("headers : {:?}", headers);
let status_code : u16 = {
let line = headers.remove("Status").unwrap_or_default();
// println!("{:?}", &line);
println!("{:?}", &line);
let line = line.into_iter().next().unwrap_or_default();
let parts : Vec<&str> = line.split(' ').collect();
parts.into_iter().next().unwrap_or("").parse().unwrap_or(200)
};
// println!("{}", status_code);
println!("status code {}", status_code);
let statusCode = match StatusCode::from_u16(status_code) {
Ok(v) => {Ok(v)}
@ -201,9 +204,12 @@ async fn git_proto(payload : web::Payload, web::Path((owner, reponame)): web::Pa
}
}
println!("headers written");
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"));
// builder.streaming(stream::repeat_with(rdr.rea))
return Ok(builder.body(body));
}