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/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c index 6cc69e0..16a4d70 100644 --- src/hg/hgGateway/hgGateway.c +++ src/hg/hgGateway/hgGateway.c @@ -818,35 +818,37 @@ sqlSafef(query, sizeof(query), "select distinct(concat(db, concat(',', hubUrl))) from %s " "where track = '' and text like '%% %s%%'", hubSearchTableName, term); hubDbUrlList = sqlQuickList(conn, query); aHubMatchList = filterHubSearchTextMatches(dbDbList, hubDbUrlList); } } hDisconnectCentral(&conn); return aHubMatchList; } static char *getSearchTermUpperCase() /* If we don't have the SEARCH_TERM cgi param, exit with an HTTP Bad Request response. * If we do, convert it to upper case for case-insensitive matching and return it. */ { +pushWarnHandler(htmlVaBadRequestAbort); pushAbortHandler(htmlVaBadRequestAbort); char *term = cgiOptionalString(SEARCH_TERM); touppers(term); if (isEmpty(term)) errAbort("Missing required CGI parameter %s", SEARCH_TERM); +popWarnHandler(); popAbortHandler(); return term; } static void lookupTerm() /* Look for matches to term in hgcentral and print as JSON for autocomplete if found. */ { char *term = getSearchTermUpperCase(); // Write JSON response with list of matches puts("Content-Type:text/javascript\n"); // Before accessing hubs, intialize udc cache location from hg.conf: setUdcCacheDir(); struct dbDb *dbDbList = hDbDbList();