don't round-trip CGI response through UTF-8
this fixes sending binary files from a CGI script
This commit is contained in:
@@ -137,13 +137,13 @@ pub async fn cgi(
|
|||||||
con.send_status(Status::CGIError, None).await?;
|
con.send_status(Status::CGIError, None).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let cmd = String::from_utf8(cmd.stdout).unwrap();
|
let cmd = cmd.stdout;
|
||||||
if !check(cmd.as_bytes()[0], con.peer_addr, url) {
|
if !check(cmd[0], con.peer_addr, url) {
|
||||||
con.send_status(Status::CGIError, None).await?;
|
con.send_status(Status::CGIError, None).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
con.send_raw(cmd.as_bytes()).await?;
|
con.send_raw(&cmd).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user