Skip to content

Commit

Permalink
g3proxy: read out reailer for ftp over http request
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed Nov 26, 2024
1 parent ed90402 commit ff4b6a6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions g3proxy/src/serve/http_proxy/task/ftp/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,21 @@ impl<'a> FtpOverHttpTask<'a> {
);
self.upload(&mut ftp_client, clt_w, &mut body_reader, None)
.await?;
tokio::time::timeout(
self.ctx.server_config.timeout.recv_req_header,
body_reader.trailer(128),
)
.await
.map_err(|_| {
ServerTaskError::ClientAppTimeout(
"time out to read HTTP body trailer",
)
})?
.map_err(|e| {
ServerTaskError::ClientAppError(anyhow!(
"invalid chunked body: {e}"
))
})?;
if !body_reader.finished() {
// there may be trailer headers
self.should_close = true;
Expand Down

0 comments on commit ff4b6a6

Please sign in to comment.