mirror of
https://github.com/samsonjs/agate.git
synced 2026-03-25 09:05:50 +00:00
Minor cleanup in parse_request
This commit is contained in:
parent
a049beb66b
commit
cac7e394be
1 changed files with 3 additions and 4 deletions
|
|
@ -89,14 +89,13 @@ async fn parse_request(stream: &mut TlsStream<TcpStream>) -> Result<Url> {
|
|||
while !buf.is_empty() {
|
||||
let n = stream.read(buf).await?;
|
||||
len += n;
|
||||
if n == 0 || request[..len].ends_with(b"\r\n") {
|
||||
if request[..len].ends_with(b"\r\n") {
|
||||
break;
|
||||
} else if n == 0 {
|
||||
Err("Request ended unexpectedly")?
|
||||
}
|
||||
buf = &mut request[len..];
|
||||
}
|
||||
if !request[..len].ends_with(b"\r\n") {
|
||||
Err("Missing CRLF")?
|
||||
}
|
||||
let request = str::from_utf8(&request[..len - 2])?;
|
||||
|
||||
let url = if request.starts_with("//") {
|
||||
|
|
|
|||
Loading…
Reference in a new issue