mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
cgi: issue CGI_TERMINATED also on reap
We also need to report CGI_TERMINATED when reaping children that closed by themselves. Keep an extra copy of the pid outside of the lws_spawn object so it's still around by then.
This commit is contained in:
parent
270a14813f
commit
c19dc963c9
2 changed files with 12 additions and 0 deletions
|
@ -90,6 +90,14 @@ lws_cgi_reap_cb(void *opaque, lws_usec_t *accounting, siginfo_t *si,
|
|||
int we_killed_him)
|
||||
{
|
||||
struct lws *wsi = (struct lws *)opaque;
|
||||
struct lws_cgi_args args;
|
||||
|
||||
if (wsi->http.cgi &&
|
||||
user_callback_handle_rxflow(wsi->a.protocol->callback, wsi,
|
||||
LWS_CALLBACK_CGI_TERMINATED,
|
||||
wsi->user_space, (void *)&args,
|
||||
(unsigned int)wsi->http.cgi->pi))
|
||||
lwsl_notice("\n");
|
||||
|
||||
/*
|
||||
* The cgi has come to an end, by itself or with a signal...
|
||||
|
@ -418,6 +426,8 @@ lws_cgi(struct lws *wsi, const char * const *exec_array,
|
|||
goto bail;
|
||||
}
|
||||
|
||||
wsi->http.cgi->pi = wsi->http.cgi->lsp->child_pid;
|
||||
|
||||
/* we are the parent process */
|
||||
|
||||
wsi->a.context->count_cgi_spawned++;
|
||||
|
|
|
@ -75,6 +75,8 @@ struct lws_cgi {
|
|||
lws_filepos_t content_length;
|
||||
lws_filepos_t content_length_seen;
|
||||
|
||||
pid_t pi;
|
||||
|
||||
int match[SIGNIFICANT_HDR_COUNT];
|
||||
char l[12];
|
||||
int response_code;
|
||||
|
|
Loading…
Add table
Reference in a new issue