571504b8602e77298d8b8d7cbdf5bddc348e6020 angie Fri Sep 21 15:53:28 2018 -0700 hgSuggest, when invoked with no params, was getting a SEGV instead of printing a 'Status: 400' header and error message. There were two problems: a param was being used before the test for lack of params, and htmlVaBadRequestAbort was used only as an AbortHandler -- it needs to be a WarnHandler, otherwise the error message is printed out before the header. A couple other places also needed to install htmlVaBadRequestAbort as a WarnHandler not just AbortHandler. diff --git src/inc/htmshell.h src/inc/htmshell.h index db1966a..9d85f45 100644 --- src/inc/htmshell.h +++ src/inc/htmshell.h @@ -155,32 +155,34 @@ * or htmShell. */ void htmlBadVar(char *varName); /* Complain about input variables. */ void htmlImage(char *fileName, int width, int height); /* Display centered image file. */ jmp_buf htmlRecover; /* Error recovery jump. Exposed for cart's use. */ void htmlVaWarn(char *format, va_list args); /* Write an error message. (Generally you just call warn() or errAbort(). * This is exposed mostly for the benefit of the cart.) */ void htmlVaBadRequestAbort(char *format, va_list args); -/* Print out an HTTP header 400 status code (Bad Request) and message, - * then exit with error. For use as an errAbort handler. */ +/* Print out an HTTP header 400 status code (Bad Request) and message, then exit with error. + * NOTE: This must be installed using pushWarnHandler (pushAbortHandler optional) because + * vaErrAbort calls vaWarn and then noWarnAbort. So if the defaut warn handler is used, then + * the error message will be printed out by defaultVaWarn before this prints out the header. */ char *htmlWarnStartPattern(); /* Return starting pattern for warning message. */ char *htmlWarnEndPattern(); /* Return ending pattern for warning message. */ void htmlWarnBoxSetup(FILE *f); /* Creates an invisible, empty warning box than can be filled with errors * and then made visible. */ void htmlAbort(); /* Terminate HTML file. Exposed for cart's use. */ void htmlPushEarlyHandlers();