diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-03-31 09:55:40 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-03-31 09:55:40 +0000 |
commit | 61627f5f52da250a7533bf0c36a9afe78cc2841a (patch) | |
tree | f1ddbaeb30be1d51b66285d1324dd25304f0edfd /usr.sbin | |
parent | c87fb40b9b3e3d0c989a3803f7ed1701c6555640 (diff) |
When the slowcgi timeout fires but no process what yet started terminate
the session with a HTTP 408 error.
OK tb@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgplgd/slowcgi.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/bgplgd/slowcgi.c b/usr.sbin/bgplgd/slowcgi.c index f5fabf54ebf..f20eb8afdd7 100644 --- a/usr.sbin/bgplgd/slowcgi.c +++ b/usr.sbin/bgplgd/slowcgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slowcgi.c,v 1.5 2022/10/27 13:24:22 claudio Exp $ */ +/* $OpenBSD: slowcgi.c,v 1.6 2023/03/31 09:55:39 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> @@ -159,6 +159,7 @@ void parse_begin_request(uint8_t *, uint16_t, struct request *, void parse_params(uint8_t *, uint16_t, struct request *, uint16_t); void parse_stdin(uint8_t *, uint16_t, struct request *, uint16_t); char *env_get(struct request *, const char *); +void error_response(struct request *, int); void exec_cgi(struct request *); void script_std_in(int, short, void *); void script_err_in(int, short, void *); @@ -505,6 +506,12 @@ slowcgi_timeout(int fd, short events, void *arg) if (c->script_flags & SCRIPT_DONE) return; + if (c->command_pid == 0) { + c->command_status = SIGALRM; + error_response(c, 408); + return; + } + ldebug("timeout fired for pid %d", c->command_pid); if (c->timeout_fired) @@ -887,7 +894,7 @@ http_error(int *res) return "Internal Server Error"; } -static void +void error_response(struct request *c, int res) { const char *type = "text/html"; |