mirror of
https://github.com/actix/actix-web.git
synced 2024-11-25 19:11:10 +00:00
Replace deprecated twoway with memchr (#2909)
This commit is contained in:
parent
f8cb71e789
commit
068909f1b3
2 changed files with 3 additions and 3 deletions
|
@ -24,7 +24,7 @@ httparse = "1.3"
|
||||||
local-waker = "0.1"
|
local-waker = "0.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mime = "0.3"
|
mime = "0.3"
|
||||||
twoway = "0.2"
|
memchr = "2.5"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-rt = "2.2"
|
actix-rt = "2.2"
|
||||||
|
|
|
@ -606,7 +606,7 @@ impl InnerField {
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
return if let Some(idx) = twoway::find_bytes(&payload.buf[pos..], b"\r") {
|
return if let Some(idx) = memchr::memmem::find(&payload.buf[pos..], b"\r") {
|
||||||
let cur = pos + idx;
|
let cur = pos + idx;
|
||||||
|
|
||||||
// check if we have enough data for boundary detection
|
// check if we have enough data for boundary detection
|
||||||
|
@ -827,7 +827,7 @@ impl PayloadBuffer {
|
||||||
|
|
||||||
/// Read until specified ending
|
/// Read until specified ending
|
||||||
fn read_until(&mut self, line: &[u8]) -> Result<Option<Bytes>, MultipartError> {
|
fn read_until(&mut self, line: &[u8]) -> Result<Option<Bytes>, MultipartError> {
|
||||||
let res = twoway::find_bytes(&self.buf, line)
|
let res = memchr::memmem::find(&self.buf, line)
|
||||||
.map(|idx| self.buf.split_to(idx + line.len()).freeze());
|
.map(|idx| self.buf.split_to(idx + line.len()).freeze());
|
||||||
|
|
||||||
if res.is_none() && self.eof {
|
if res.is_none() && self.eof {
|
||||||
|
|
Loading…
Reference in a new issue