try debug
This commit is contained in:
parent
ee1efbe8aa
commit
04b8b43343
12
src/main.rs
12
src/main.rs
|
@ -26,6 +26,7 @@ use std::io::{Read, BufRead, Write, ErrorKind};
|
||||||
use futures::{StreamExt, TryStreamExt, future};
|
use futures::{StreamExt, TryStreamExt, future};
|
||||||
use actix_web::web::Buf;
|
use actix_web::web::Buf;
|
||||||
use actix_web::http::header::IntoHeaderValue;
|
use actix_web::http::header::IntoHeaderValue;
|
||||||
|
use futures::stream;
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "hello.html")]
|
#[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());
|
.push(value.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("headers : {:?}", headers);
|
||||||
|
|
||||||
let status_code : u16 = {
|
let status_code : u16 = {
|
||||||
let line = headers.remove("Status").unwrap_or_default();
|
let line = headers.remove("Status").unwrap_or_default();
|
||||||
// println!("{:?}", &line);
|
println!("{:?}", &line);
|
||||||
let line = line.into_iter().next().unwrap_or_default();
|
let line = line.into_iter().next().unwrap_or_default();
|
||||||
let parts : Vec<&str> = line.split(' ').collect();
|
let parts : Vec<&str> = line.split(' ').collect();
|
||||||
parts.into_iter().next().unwrap_or("").parse().unwrap_or(200)
|
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) {
|
let statusCode = match StatusCode::from_u16(status_code) {
|
||||||
Ok(v) => {Ok(v)}
|
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();
|
let mut body = Vec::new();
|
||||||
rdr.read_to_end(&mut body)?;
|
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));
|
return Ok(builder.body(body));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue