~int80h/public-inbox

gemserv: don't round-trip CGI response through UTF-8 v1 APPLIED

boringcactus: 1
 don't round-trip CGI response through UTF-8

 1 files changed, 3 insertions(+), 3 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~int80h/public-inbox/patches/14926/mbox | git am -3
Learn more about email & git

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

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