~int80h/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH gemserv] don't round-trip CGI response through UTF-8

Details
Message ID
<20201111230628.7980-1-boringcactus@gmail.com>
DKIM signature
missing
Download raw message
Patch: +3 -3
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
Reply to thread Export thread (mbox)