remove debug logs mistakenly added in 644ea4e6
This commit is contained in:
parent
abf4eba42d
commit
4f25412c3f
12
src/web.rs
12
src/web.rs
|
@ -178,7 +178,6 @@ fn internal_server_err<E: Into<Error>>(err: E) -> Response<Body> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_base_error(err: base::Error) -> Response<Body> {
|
fn from_base_error(err: base::Error) -> Response<Body> {
|
||||||
info!("base error: {:?}", &err);
|
|
||||||
let status_code = match err.kind() {
|
let status_code = match err.kind() {
|
||||||
ErrorKind::PermissionDenied | ErrorKind::Unauthenticated => StatusCode::UNAUTHORIZED,
|
ErrorKind::PermissionDenied | ErrorKind::Unauthenticated => StatusCode::UNAUTHORIZED,
|
||||||
ErrorKind::InvalidArgument => StatusCode::BAD_REQUEST,
|
ErrorKind::InvalidArgument => StatusCode::BAD_REQUEST,
|
||||||
|
@ -709,7 +708,6 @@ impl ServiceInner {
|
||||||
// TODO: real error handling! this assumes all errors are due to lack of
|
// TODO: real error handling! this assumes all errors are due to lack of
|
||||||
// authentication, when they could be logic errors in SQL or such.
|
// authentication, when they could be logic errors in SQL or such.
|
||||||
if let Ok((s, u)) = self.db.lock().authenticate_session(authreq.clone(), &sid.hash()) {
|
if let Ok((s, u)) = self.db.lock().authenticate_session(authreq.clone(), &sid.hash()) {
|
||||||
info!("authenticate_session success");
|
|
||||||
return Ok(Caller {
|
return Ok(Caller {
|
||||||
permissions: s.permissions.clone(),
|
permissions: s.permissions.clone(),
|
||||||
session: Some(json::Session {
|
session: Some(json::Session {
|
||||||
|
@ -721,8 +719,6 @@ impl ServiceInner {
|
||||||
info!("authenticate_session failed");
|
info!("authenticate_session failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("fallthrough");
|
|
||||||
|
|
||||||
if let Some(s) = self.allow_unauthenticated_permissions.as_ref() {
|
if let Some(s) = self.allow_unauthenticated_permissions.as_ref() {
|
||||||
return Ok(Caller {
|
return Ok(Caller {
|
||||||
permissions: s.clone(),
|
permissions: s.clone(),
|
||||||
|
@ -754,7 +750,6 @@ fn extract_sid(req: &Request<hyper::Body>) -> Option<auth::RawSessionId> {
|
||||||
Some(c) => c,
|
Some(c) => c,
|
||||||
};
|
};
|
||||||
for mut cookie in hdr.as_bytes().split(|&b| b == b';') {
|
for mut cookie in hdr.as_bytes().split(|&b| b == b';') {
|
||||||
info!("got cookie: {:?}", String::from_utf8_lossy(cookie));
|
|
||||||
if cookie.starts_with(b" ") {
|
if cookie.starts_with(b" ") {
|
||||||
cookie = &cookie[1..];
|
cookie = &cookie[1..];
|
||||||
}
|
}
|
||||||
|
@ -762,8 +757,6 @@ fn extract_sid(req: &Request<hyper::Body>) -> Option<auth::RawSessionId> {
|
||||||
let s = &cookie[2..];
|
let s = &cookie[2..];
|
||||||
if let Ok(s) = auth::RawSessionId::decode_base64(s) {
|
if let Ok(s) = auth::RawSessionId::decode_base64(s) {
|
||||||
return Some(s);
|
return Some(s);
|
||||||
} else {
|
|
||||||
info!("decode_base64 failure");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1028,10 +1021,7 @@ impl ::hyper::service::Service for Service {
|
||||||
fn wrap<R>(is_private: bool, r: R)
|
fn wrap<R>(is_private: bool, r: R)
|
||||||
-> Box<dyn Future<Item = Response<Body>, Error = BoxedError> + Send + 'static>
|
-> Box<dyn Future<Item = Response<Body>, Error = BoxedError> + Send + 'static>
|
||||||
where R: Future<Item = Response<Body>, Error = Response<Body>> + Send + 'static {
|
where R: Future<Item = Response<Body>, Error = Response<Body>> + Send + 'static {
|
||||||
return Box::new(r.or_else(|e| {
|
return Box::new(r.or_else(|e| Ok(e)).map(move |mut r| {
|
||||||
info!("returning error status {:?}", e.status());
|
|
||||||
Ok(e)
|
|
||||||
}).map(move |mut r| {
|
|
||||||
if is_private {
|
if is_private {
|
||||||
r.headers_mut().insert("Cache-Control", HeaderValue::from_static("private"));
|
r.headers_mut().insert("Cache-Control", HeaderValue::from_static("private"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue