NSAPI_PUBLIC PRBool conf_deleteGlobal(char *name) { pb_param *oldParam; pblock *globals = conf_get_true_globals()->genericGlobals; char *d = _lowercase(name); oldParam = pblock_remove(d, globals); FREE(d); return oldParam==NULL?PR_FALSE:PR_TRUE; }
NSAPI_PUBLIC PRBool conf_setGlobal(char *name, char *value) { pblock *globals = conf_get_true_globals()->genericGlobals; char *d = _lowercase(name); if (pblock_find(d, globals)) { // Mark directive as multiply defined pblock_nvinsert(d, name, globalsMultiplyDefined); param_free(pblock_remove(d, globals)); } else { // Mark directive as unaccessed pblock_nvinsert(d, name, globalsUnaccessed); } PRBool rv = (pblock_nvinsert(d, value, globals) != NULL); FREE(d); return rv; }
static void parse_headers(http_parser_t *parser, char **line, int lines) { int i,l; int whitespace, where, slen; char *name = NULL; char *value = NULL; /* parse the name: value lines. */ for (l = 1; l < lines; l++) { where = 0; whitespace = 0; name = line[l]; value = NULL; slen = strlen(line[l]); for (i = 0; i < slen; i++) { if (line[l][i] == ':') { whitespace = 1; line[l][i] = '\0'; } else { if (whitespace) { whitespace = 0; while (i < slen && line[l][i] == ' ') i++; if (i < slen) value = &line[l][i]; break; } } } if (name != NULL && value != NULL) { httpp_setvar(parser, _lowercase(name), value); name = NULL; value = NULL; } } }
NSAPI_PUBLIC char *conf_findGlobal(char *name) { if (!conf_api_initialized) { log_ereport(LOG_VERBOSE, XP_GetAdminStr(DBT_confApiCallBeforeInit)); return NULL; } char *rv = NULL; char *d = _lowercase(name); if (d) { // Mark directive as accessed if (globalsUnaccessed) param_free(pblock_remove(d, globalsUnaccessed)); // Lookup directive rv = pblock_findval(d, conf_get_true_globals()->genericGlobals); FREE(d); } return rv; }