mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
remove unsafe
This commit is contained in:
parent
1c3b32169e
commit
5b7aed101a
@ -260,15 +260,14 @@ impl Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unmask
|
// unmask
|
||||||
if let Some(mask) = mask {
|
let data = if let Some(mask) = mask {
|
||||||
// Unsafe: request body stream is owned by WsStream. only one ref to
|
let mut buf = BytesMut::new();
|
||||||
// bytes exists. Bytes object get freezed in continuous non-overlapping blocks
|
buf.extend_from_slice(&data);
|
||||||
let p: &mut [u8] = unsafe {
|
apply_mask(&mut buf, mask);
|
||||||
let ptr: &[u8] = &data;
|
buf.freeze()
|
||||||
&mut *(ptr as *const _ as *mut _)
|
} else {
|
||||||
};
|
data
|
||||||
apply_mask(p, mask);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Async::Ready(Some(Frame {
|
Ok(Async::Ready(Some(Frame {
|
||||||
finished,
|
finished,
|
||||||
|
Loading…
Reference in New Issue
Block a user