Fix unused variable warning
This commit is contained in:
@@ -68,7 +68,6 @@ pub trait DavRequestHandler: Sync + Send {
|
|||||||
pub(crate) trait DavRequestDispatcher: Sync + Send {
|
pub(crate) trait DavRequestDispatcher: Sync + Send {
|
||||||
fn dispatch_dav_request(
|
fn dispatch_dav_request(
|
||||||
&self,
|
&self,
|
||||||
request: &HttpRequest,
|
|
||||||
headers: &RequestHeaders<'_>,
|
headers: &RequestHeaders<'_>,
|
||||||
access_token: Arc<AccessToken>,
|
access_token: Arc<AccessToken>,
|
||||||
resource: DavResourceName,
|
resource: DavResourceName,
|
||||||
@@ -80,7 +79,6 @@ pub(crate) trait DavRequestDispatcher: Sync + Send {
|
|||||||
impl DavRequestDispatcher for Server {
|
impl DavRequestDispatcher for Server {
|
||||||
async fn dispatch_dav_request(
|
async fn dispatch_dav_request(
|
||||||
&self,
|
&self,
|
||||||
request: &HttpRequest,
|
|
||||||
headers: &RequestHeaders<'_>,
|
headers: &RequestHeaders<'_>,
|
||||||
access_token: Arc<AccessToken>,
|
access_token: Arc<AccessToken>,
|
||||||
resource: DavResourceName,
|
resource: DavResourceName,
|
||||||
@@ -122,27 +120,20 @@ impl DavRequestDispatcher for Server {
|
|||||||
// Validate permissions
|
// Validate permissions
|
||||||
access_token.assert_has_permission(Permission::DavFileGet)?;
|
access_token.assert_has_permission(Permission::DavFileGet)?;
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
// Deal with Litmus bug
|
||||||
{
|
/*self.handle_file_get_request(
|
||||||
// Deal with Litmus bug
|
&access_token,
|
||||||
self.handle_file_get_request(
|
headers,
|
||||||
&access_token,
|
matches!(method, DavMethod::HEAD)
|
||||||
headers,
|
&& !request.headers().contains_key("x-litmus"),
|
||||||
matches!(method, DavMethod::HEAD)
|
)
|
||||||
&& !request.headers().contains_key("x-litmus"),
|
.await*/
|
||||||
)
|
self.handle_file_get_request(
|
||||||
.await
|
&access_token,
|
||||||
}
|
headers,
|
||||||
|
matches!(method, DavMethod::HEAD),
|
||||||
#[cfg(not(debug_assertions))]
|
)
|
||||||
{
|
.await
|
||||||
self.handle_file_get_request(
|
|
||||||
&access_token,
|
|
||||||
headers,
|
|
||||||
matches!(method, DavMethod::HEAD),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DavResourceName::Scheduling => {
|
DavResourceName::Scheduling => {
|
||||||
// Validate permissions
|
// Validate permissions
|
||||||
@@ -611,9 +602,6 @@ impl DavRequestHandler for Server {
|
|||||||
Vec::new()
|
Vec::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
//let c = println!("------------------------------------------");
|
|
||||||
//let std_body = std::str::from_utf8(&body).unwrap_or("[binary]").to_string();
|
|
||||||
|
|
||||||
// Parse headers
|
// Parse headers
|
||||||
let mut headers = RequestHeaders::new(request.uri().path());
|
let mut headers = RequestHeaders::new(request.uri().path());
|
||||||
for (key, value) in request.headers() {
|
for (key, value) in request.headers() {
|
||||||
@@ -622,7 +610,7 @@ impl DavRequestHandler for Server {
|
|||||||
|
|
||||||
let start_time = Instant::now();
|
let start_time = Instant::now();
|
||||||
match self
|
match self
|
||||||
.dispatch_dav_request(&request, &headers, access_token, resource, method, body)
|
.dispatch_dav_request(&headers, access_token, resource, method, body)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
@@ -742,23 +730,6 @@ impl DavRequestHandler for Server {
|
|||||||
HttpResponse::new(code)
|
HttpResponse::new(code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*let c = println!(
|
|
||||||
"{:?} {} -> {:?}\nHeaders: {:?}\nBody: {}\nResponse headers: {:?}\nResponse: {}",
|
|
||||||
method,
|
|
||||||
request.uri().path(),
|
|
||||||
result.status(),
|
|
||||||
request.headers(),
|
|
||||||
std_body,
|
|
||||||
result.headers().unwrap(),
|
|
||||||
match &result.body() {
|
|
||||||
http_proto::HttpResponseBody::Text(t) => dav_proto::xml_pretty_print(t),
|
|
||||||
http_proto::HttpResponseBody::Empty => "[empty]".to_string(),
|
|
||||||
_ => "[binary]".to_string(),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
result*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user