From: Melody Horn <melody@boringcactus.com>
this fixes sending binary files from a CGI script
---
Sent this directly to int80h, but it's probably wise to put it on the
mailing list as well, just in case.
src/cgi.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/cgi.rs b/src/cgi.rs
index a5dd900..1605d53 100644
--- a/src/cgi.rs
+++ b/src/cgi.rs
@@ -137,13 +137,13 @@ pub async fn cgi(
con.send_status(Status::CGIError, None).await?;
return Ok(());
}
- let cmd = String::from_utf8(cmd.stdout).unwrap();
- if !check(cmd.as_bytes()[0], con.peer_addr, url) {
+ let cmd = cmd.stdout;
+ if !check(cmd[0], con.peer_addr, url) {
con.send_status(Status::CGIError, None).await?;
return Ok(());
}
- con.send_raw(cmd.as_bytes()).await?;
+ con.send_raw(&cmd).await?;
return Ok(());
}
--
2.20.1.windows.1