update error handling
This commit is contained in:
parent
1a70869227
commit
f080f2e12d
7 changed files with 23 additions and 14 deletions
|
|
@ -96,7 +96,7 @@ where
|
|||
size += body.remaining();
|
||||
if size > max_body_size {
|
||||
error!("Exceeds max request body size for HTTP/3");
|
||||
return Err(anyhow!("Exceeds max request body size for HTTP/3"));
|
||||
return Err(RpxyError::Proxy("Exceeds max request body size for HTTP/3".to_string()));
|
||||
}
|
||||
// create stream body to save memory, shallow copy (increment of ref-count) to Bytes using copy_to_bytes
|
||||
sender.send_data(body.copy_to_bytes(body.remaining())).await?;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ where
|
|||
debug!("HTTP/2 or 1.1: SNI in ClientHello: {:?}", server_name);
|
||||
let server_name = server_name.map_or_else(|| None, |v| Some(v.to_server_name_vec()));
|
||||
if server_name.is_none(){
|
||||
Err(anyhow!("No SNI is given"))
|
||||
Err(RpxyError::Proxy("No SNI is given".to_string()))
|
||||
} else {
|
||||
// this immediately spawns another future to actually handle stream. so it is okay to introduce timeout for handshake.
|
||||
self_inner.client_serve(stream, server_clone, client_addr, server_name); // TODO: don't want to pass copied value...
|
||||
|
|
@ -76,11 +76,11 @@ where
|
|||
}
|
||||
},
|
||||
Err(e) => {
|
||||
Err(anyhow!("Failed to handshake TLS: {}", e))
|
||||
Err(RpxyError::Proxy(format!("Failed to handshake TLS: {}", e)))
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
Err(anyhow!("Timeout to handshake TLS: {}", e))
|
||||
Err(RpxyError::Proxy(format!("Timeout to handshake TLS: {}", e)))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue