diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-23 05:21:04 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:23 -0500 |
commit | 8f9478b09d39d8c13871684a6af3d3e1629a0e84 (patch) | |
tree | 282e9f837fa18e9c5e7d26049cfb2818c1c6bfa9 /source4/web_server | |
parent | a92e61c4528b46628275216c9252a7a7f6e07dfc (diff) | |
download | samba-8f9478b09d39d8c13871684a6af3d3e1629a0e84.tar.gz samba-8f9478b09d39d8c13871684a6af3d3e1629a0e84.tar.bz2 samba-8f9478b09d39d8c13871684a6af3d3e1629a0e84.zip |
r9504: use some low level ejs hackery to give much better exception error messages in both
the web server and smbscript. We can now give backtraces for all internal asserts, not
just high level errors
(This used to be commit 84c756b25ccb2bd75360bdb9b7b7643975d1f3b3)
Diffstat (limited to 'source4/web_server')
-rw-r--r-- | source4/web_server/http.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/source4/web_server/http.c b/source4/web_server/http.c index 7aa99b09f6..dc8f236567 100644 --- a/source4/web_server/http.c +++ b/source4/web_server/http.c @@ -29,6 +29,7 @@ #include "system/iconv.h" #include "system/time.h" #include "lib/appweb/esp/esp.h" +#include "lib/appweb/ejs/ejsInternal.h" #include "dlinklist.h" #include "lib/tls/tls.h" @@ -43,17 +44,6 @@ struct esp_state { struct session_data *session; }; -/* destroy a esp session */ -static int esp_destructor(void *ptr) -{ - struct esp_state *esp = talloc_get_type(ptr, struct esp_state); - - if (esp->req) { - espDestroyRequest(esp->req); - } - return 0; -} - /* output the http headers */ @@ -338,7 +328,7 @@ static void http_destroySession(EspHandle handle) void http_error(struct websrv_context *web, int code, const char *info) { char *s; - s = talloc_asprintf(web,"<HTML><HEAD><TITLE>Error %u</TITLE></HEAD><BODY><H1>Error %u</H1>%s<p></BODY></HTML>\r\n\r\n", + s = talloc_asprintf(web,"<HTML><HEAD><TITLE>Error %u</TITLE></HEAD><BODY><H1>Error %u</H1><pre>%s</pre><p></BODY></HTML>\r\n\r\n", code, code, info); if (s == NULL) { stream_terminate_connection(web->conn, "http_error: out of memory"); @@ -468,8 +458,14 @@ static const char *exception_reason; void ejs_exception(const char *reason) { - exception_reason = reason; - DEBUG(0,("%s", reason)); + Ejs *ep = ejsPtr(0); + if (ep) { + ejsSetErrorMsg(0, "%s", reason); + exception_reason = ep->error; + } else { + exception_reason = reason; + } + DEBUG(0,("%s", exception_reason)); longjmp(ejs_exception_buf, -1); } #else @@ -797,8 +793,6 @@ void http_process_input(struct websrv_context *web) edata->application_data, MPR_DEEP_COPY); } - talloc_set_destructor(esp, esp_destructor); - smb_setup_ejs_functions(); if (web->input.url == NULL) { |