Skip to content

Commit caa4b20

Browse files
committed
http: add missing get_mode_data + cancel methods
Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent cdc6d47 commit caa4b20

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

uefi/src/proto/network/http.rs

+18
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ use uefi_raw::protocol::network::http::{
3131
pub struct Http(HttpProtocol);
3232

3333
impl Http {
34+
/// Receive HTTP Protocol configuration.
35+
pub fn get_mode_data(&mut self, config_data: &mut HttpConfigData) -> uefi::Result<()> {
36+
let status = unsafe { (self.0.get_mode_data)(&mut self.0, config_data) };
37+
match status {
38+
Status::SUCCESS => Ok(()),
39+
_ => Err(status.into()),
40+
}
41+
}
42+
3443
/// Configure HTTP Protocol. Must be called before sending HTTP requests.
3544
pub fn configure(&mut self, config_data: &HttpConfigData) -> uefi::Result<()> {
3645
let status = unsafe { (self.0.configure)(&mut self.0, config_data) };
@@ -49,6 +58,15 @@ impl Http {
4958
}
5059
}
5160

61+
/// Cancel HTTP request.
62+
pub fn cancel(&mut self, token: &mut HttpToken) -> uefi::Result<()> {
63+
let status = unsafe { (self.0.cancel)(&mut self.0, token) };
64+
match status {
65+
Status::SUCCESS => Ok(()),
66+
_ => Err(status.into()),
67+
}
68+
}
69+
5270
/// Receive HTTP response.
5371
pub fn response(&mut self, token: &mut HttpToken) -> uefi::Result<()> {
5472
let status = unsafe { (self.0.response)(&mut self.0, token) };

0 commit comments

Comments
 (0)