diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-20 04:38:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:33:34 -0500 |
commit | fd74e3e1f5eb1a20be773627864415676b0cec21 (patch) | |
tree | 23a359a147c088cb5735c25d7fecf5b94794f8a1 /source4/web_server/http.c | |
parent | 3fd6b47502bac57ca720e372d80843ae63c02723 (diff) | |
download | samba-fd74e3e1f5eb1a20be773627864415676b0cec21.tar.gz samba-fd74e3e1f5eb1a20be773627864415676b0cec21.tar.bz2 samba-fd74e3e1f5eb1a20be773627864415676b0cec21.zip |
r9409: fix a problem that volker noticed with web page timeouts causing smbd
to crash. This is one of the downsides of the fact that the ejs engine
is not event driven, resulting in the rendering of each web page being
'semi-async'. We need to protect the web context from the timeout
processing until we have unwound the stack back to the point that the
'web' variable representing the page rendering logic won't be used any
more.
(This used to be commit 97e3c9eaf1a917eb504a2c3414c5d2b64cd4539a)
Diffstat (limited to 'source4/web_server/http.c')
-rw-r--r-- | source4/web_server/http.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/web_server/http.c b/source4/web_server/http.c index 7bb45afc1e..7aa99b09f6 100644 --- a/source4/web_server/http.c +++ b/source4/web_server/http.c @@ -501,6 +501,7 @@ static void esp_request(struct esp_state *esp, const char *url) return; } #endif + res = espProcessRequest(esp->req, url, buf, &emsg); if (res != 0 && emsg) { http_writeBlock(web, "<pre>", 5); @@ -866,6 +867,12 @@ void http_process_input(struct websrv_context *web) } } + if (web->conn == NULL) { + /* the connection has been terminated above us, probably + via a timeout */ + goto internal_error; + } + if (!web->output.output_pending) { http_output_headers(web); EVENT_FD_WRITEABLE(web->conn->event.fde); @@ -909,7 +916,9 @@ void http_process_input(struct websrv_context *web) internal_error: mprSetCtx(esp); talloc_free(esp); - http_error(web, 500, "Internal server error"); + if (web->conn != NULL) { + http_error(web, 500, "Internal server error"); + } mprSetCtx(save_mpr_ctx); ejs_restore_state(ejs_save); } |