Update axum
This commit is contained in:
parent
766a36426b
commit
42d551eb6e
5 changed files with 142 additions and 52 deletions
|
|
@ -9,6 +9,7 @@ mod r#static;
|
|||
use axum::{extract::DefaultBodyLimit, routing::get, Router};
|
||||
use axum_extra::routing::RouterExt;
|
||||
use log::info;
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
use crate::somehow;
|
||||
|
||||
|
|
@ -71,9 +72,8 @@ pub async fn run(server: Server) -> somehow::Result<()> {
|
|||
|
||||
let addr = &server.config.web_address;
|
||||
info!("Launching web server at http://{}", addr);
|
||||
axum::Server::bind(addr)
|
||||
.serve(app.into_make_service())
|
||||
.await?;
|
||||
let listener = TcpListener::bind(addr).await?;
|
||||
axum::serve(listener, app).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,15 @@ mod stream;
|
|||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use axum::{
|
||||
body::StreamBody,
|
||||
body::Body,
|
||||
extract::State,
|
||||
headers::{authorization::Basic, Authorization},
|
||||
http::StatusCode,
|
||||
http::{header, HeaderValue},
|
||||
http::{header, HeaderValue, StatusCode},
|
||||
response::{IntoResponse, Response},
|
||||
Json, TypedHeader,
|
||||
Json,
|
||||
};
|
||||
use axum_extra::{
|
||||
headers::{authorization::Basic, Authorization},
|
||||
TypedHeader,
|
||||
};
|
||||
use gix::{ObjectId, ThreadSafeRepository};
|
||||
use log::{debug, info};
|
||||
|
|
@ -201,7 +203,7 @@ fn stream_response(repo: Arc<ThreadSafeRepository>, id: ObjectId) -> impl IntoRe
|
|||
HeaderValue::from_static("attachment; filename=\"tree.tar.gz\""),
|
||||
),
|
||||
],
|
||||
StreamBody::new(stream::tar_and_gzip(repo, id)),
|
||||
Body::from_stream(stream::tar_and_gzip(repo, id)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
//! Verify worker basic authentication headers.
|
||||
|
||||
use axum::{
|
||||
headers::{authorization::Basic, Authorization},
|
||||
http::{header, HeaderValue, StatusCode},
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
use axum_extra::{
|
||||
headers::{authorization::Basic, Authorization},
|
||||
TypedHeader,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue