diff options
-rw-r--r-- | source4/web_server/esp/esp.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/source4/web_server/esp/esp.c b/source4/web_server/esp/esp.c index 4041823093..12a9471015 100644 --- a/source4/web_server/esp/esp.c +++ b/source4/web_server/esp/esp.c @@ -167,9 +167,9 @@ EspRequest *espCreateRequest(EspHandle webServerRequestHandle, char *uri, * NOTE: MaRequest::setVar does not copy into globals, whereas espSetVar * does if legacy_api is defined. So variables pre-defined by MaRequest * must be copied here into globals[].
- *
- * NOTE: if a variable is in session[] and in form[], the form[] will
- * override being later in the variables[] list. Use mprSetProperty
+ * + * NOTE: if a variable is in session[] and in form[], the form[] will + * override being later in the variables[] list. Use mprSetProperty * instead of mprCreateProperty to cover for this case. */ for (i = 0; i < ESP_OBJ_MAX; i++) { @@ -769,13 +769,13 @@ static int buildScript(EspRequest *ep, char **jsBuf, char *input, char **errMsg) state = ESP_STATE_BEGIN; break; - case ESP_TOK_INCLUDE:
- if (parse.token[0] == '/') {
- mprStrcpy(incPath, sizeof(incPath), parse.token);
- } else {
- mprGetDirName(dir, sizeof(dir), ep->uri);
- mprSprintf(incPath, sizeof(incPath), "%s/%s",
- dir, parse.token);
+ case ESP_TOK_INCLUDE: + if (parse.token[0] == '/') { + mprStrcpy(incPath, sizeof(incPath), parse.token); + } else { + mprGetDirName(dir, sizeof(dir), ep->uri); + mprSprintf(incPath, sizeof(incPath), "%s/%s", + dir, parse.token); } if (esp->mapToStorage(ep->requestHandle, path, sizeof(path), incPath, 0) < 0) { @@ -797,11 +797,11 @@ static int buildScript(EspRequest *ep, char **jsBuf, char *input, char **errMsg) */ incBuf = 0; if ((rc = buildScript(ep, &incBuf, incText, errMsg)) < 0) { - mprFree(incText);
- mprFree(parse.token);
+ mprFree(incText); + mprFree(parse.token); return rc; - }
-
+ } + len = mprReallocStrcat(jsBuf, maxScriptSize, len, 0, incBuf, 0); mprFree(incText); mprFree(incBuf); @@ -810,12 +810,12 @@ static int buildScript(EspRequest *ep, char **jsBuf, char *input, char **errMsg) } tid = getEspToken(state, &parse); } - mprFree(parse.token);
- if (len < 0) {
- mprAllocSprintf(errMsg, MPR_MAX_STRING,
- "Script token is too big in %s.\nConfigured maximum is %d.",
- path, maxScriptSize);
- return MPR_ERR_WONT_FIT;
+ mprFree(parse.token); + if (len < 0) { + mprAllocSprintf(errMsg, MPR_MAX_STRING, + "Script token is too big in %s.\nConfigured maximum is %d.", + path, maxScriptSize); + return MPR_ERR_WONT_FIT; } return rc; } |