-/* $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>
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 *);
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)
return "Internal Server Error";
}
-static void
+void
error_response(struct request *c, int res)
{
const char *type = "text/html";