🔇 make logs quieter
parent
c47ab6d282
commit
d96bf801c6
|
@ -139,7 +139,7 @@ async fn serve_dir_json (
|
||||||
Ok (response)
|
Ok (response)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument (level = "debug", skip (f))]
|
// #[instrument (level = "debug", skip (f))]
|
||||||
async fn serve_file (
|
async fn serve_file (
|
||||||
uri: &str,
|
uri: &str,
|
||||||
mut f: File,
|
mut f: File,
|
||||||
|
@ -347,7 +347,7 @@ impl FileServer {
|
||||||
/// Passes a request to the internal file server logic.
|
/// Passes a request to the internal file server logic.
|
||||||
/// Returns an HTTP response as HTML or JSON, depending on the request.
|
/// Returns an HTTP response as HTML or JSON, depending on the request.
|
||||||
|
|
||||||
#[instrument (level = "debug", skip (self, headers))]
|
// #[instrument (level = "debug", skip (self, headers))]
|
||||||
pub async fn serve_all (
|
pub async fn serve_all (
|
||||||
&self,
|
&self,
|
||||||
method: Method,
|
method: Method,
|
||||||
|
|
|
@ -259,7 +259,7 @@ pub async fn serve_all (
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use Response::*;
|
use Response::*;
|
||||||
|
|
||||||
info! ("Client requested {}", uri);
|
trace! ("Client requested {}", uri);
|
||||||
|
|
||||||
let uri = http::Uri::from_str (uri).map_err (FileServerError::InvalidUri)?;
|
let uri = http::Uri::from_str (uri).map_err (FileServerError::InvalidUri)?;
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,9 @@ async fn handle_one_req (
|
||||||
response: http_serde::Response,
|
response: http_serde::Response,
|
||||||
) -> Result <(), ServerError>
|
) -> Result <(), ServerError>
|
||||||
{
|
{
|
||||||
|
let url = format! ("{}/http_response/{}", state.config.relay_url, req_id);
|
||||||
let mut resp_req = state.client
|
let mut resp_req = state.client
|
||||||
.post (&format! ("{}/http_response/{}", state.config.relay_url, req_id))
|
.post (&url)
|
||||||
.header (ptth_core::PTTH_MAGIC_HEADER, base64::encode (rmp_serde::to_vec (&response.parts).map_err (ServerError::MessagePackEncodeResponse)?))
|
.header (ptth_core::PTTH_MAGIC_HEADER, base64::encode (rmp_serde::to_vec (&response.parts).map_err (ServerError::MessagePackEncodeResponse)?))
|
||||||
.header ("X-PTTH-SERVER-NAME", &state.config.name);
|
.header ("X-PTTH-SERVER-NAME", &state.config.name);
|
||||||
|
|
||||||
|
@ -129,14 +130,14 @@ async fn handle_one_req (
|
||||||
|
|
||||||
let req = resp_req.build ().map_err (ServerError::Step5Responding)?;
|
let req = resp_req.build ().map_err (ServerError::Step5Responding)?;
|
||||||
|
|
||||||
debug! ("{:?}", req.headers ());
|
trace! ("{:?}", req.headers ());
|
||||||
|
|
||||||
//println! ("Step 6");
|
//println! ("Step 6");
|
||||||
match state.client.execute (req).await {
|
match state.client.execute (req).await {
|
||||||
Ok (r) => {
|
Ok (r) => {
|
||||||
let status = r.status ();
|
let status = r.status ();
|
||||||
let text = r.text ().await.map_err (ServerError::Step7AfterResponse)?;
|
let text = r.text ().await.map_err (ServerError::Step7AfterResponse)?;
|
||||||
debug! ("{:?} {:?}", status, text);
|
debug! ("http_response {} {:?} {:?}", req_id, status, text);
|
||||||
},
|
},
|
||||||
Err (e) => {
|
Err (e) => {
|
||||||
if e.is_request () {
|
if e.is_request () {
|
||||||
|
@ -183,7 +184,7 @@ SH: Send + FnMut () -> H
|
||||||
tokio::spawn (async move {
|
tokio::spawn (async move {
|
||||||
let (req_id, parts) = (wrapped_req.id, wrapped_req.req);
|
let (req_id, parts) = (wrapped_req.id, wrapped_req.req);
|
||||||
|
|
||||||
debug! ("Handling request {}", req_id);
|
info! ("Req {} {}", req_id, parts.uri);
|
||||||
|
|
||||||
let f = handler (parts);
|
let f = handler (parts);
|
||||||
let response = f.await?;
|
let response = f.await?;
|
||||||
|
|
Loading…
Reference in New Issue