mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-10-26 14:00:22 +00:00
start of http stuff
This commit is contained in:
1 parent
51c5ee0638
commit
8735824495
2 files changed
+32
No files matched your search
@@ -0,0 +1,14 @@
|
|||||||
|
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||||
|
use tokio::net::{
|
||||||
|
tcp::{OwnedReadHalf, OwnedWriteHalf},
|
||||||
|
TcpStream,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub async fn handle_http_get(socket: TcpStream) {
|
||||||
|
let (read_half, write_half) = socket.into_split();
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn read_get_request(socket: &mut OwnedReadHalf) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
@@ -16,12 +16,14 @@ mod car;
|
|||||||
mod client;
|
mod client;
|
||||||
mod packet;
|
mod packet;
|
||||||
mod plugins;
|
mod plugins;
|
||||||
|
mod http;
|
||||||
|
|
||||||
pub use backend::*;
|
pub use backend::*;
|
||||||
pub use car::*;
|
pub use car::*;
|
||||||
pub use client::*;
|
pub use client::*;
|
||||||
pub use packet::*;
|
pub use packet::*;
|
||||||
pub use plugins::*;
|
pub use plugins::*;
|
||||||
|
pub use http::*;
|
||||||
|
|
||||||
pub use crate::config::Config;
|
pub use crate::config::Config;
|
||||||
|
|
||||||
@@ -171,6 +173,22 @@ impl Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'D' => {
|
||||||
|
// Download connection (for old protocol)
|
||||||
|
// New protocol should use HTTP for downloads, so
|
||||||
|
// I will leave this unimplemented for now.
|
||||||
|
},
|
||||||
|
'G' => {
|
||||||
|
// This is probably an HTTP GET request!
|
||||||
|
let mut tmp = [0u8; 3];
|
||||||
|
socket.read_exact(&mut tmp).await.expect("Failed to read from socket!");
|
||||||
|
if tmp[0] as char == 'E' && tmp[1] as char == 'T' && tmp[2] as char == ' ' {
|
||||||
|
trace!("HTTP GET request found!");
|
||||||
|
handle_http_get(socket).await;
|
||||||
|
} else {
|
||||||
|
trace!("Unknown G packet received, not sure what to do!");
|
||||||
|
}
|
||||||
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user