static int createFormData() { char *pat; decodeFormData(query); pat = "application/x-www-form-urlencoded"; if (mprStrcmpAnyCaseCount(contentType, pat, (int) strlen(pat)) == 0) { if (getPostData() < 0) { return EJS_ERR; } if (contentLength > 0) { pat = "application/x-www-form-urlencoded"; if (mprStrcmpAnyCaseCount(contentType, pat, (int) strlen(pat)) == 0) { decodeFormData(input); } } } return 0; }
static char *resolveUrl(MprHttp *http, cchar *url) { if (*url == '/') { if (host) { if (mprStrcmpAnyCaseCount(host, "http://", 7) != 0 && mprStrcmpAnyCaseCount(host, "https://", 8) != 0) { return mprAsprintf(http, -1, "http://%s%s", host, url); } else { return mprAsprintf(http, -1, "%s%s", host, url); } } else { return mprAsprintf(http, -1, "http://127.0.0.1%s", url); } } if (mprStrcmpAnyCaseCount(url, "http://", 7) != 0 && mprStrcmpAnyCaseCount(url, "https://", 8) != 0) { if (*url == ':' && isPort(&url[1])) { return mprAsprintf(http, -1, "http://127.0.0.1%s", url); } else if (isPort(url)) { return mprAsprintf(http, -1, "http://127.0.0.1:%s", url); } else { return mprAsprintf(http, -1, "http://%s", url); } } return mprStrdup(http, url); }
static void trace(MprHttp *http, cchar *url, int fetchCount, cchar *method, int code, int contentLen) { if (mprStrcmpAnyCaseCount(url, "http://", 7) != 0) { url += 7; } if ((fetchCount % 200) == 1) { if (fetchCount == 1 || (fetchCount % 5000) == 1) { if (fetchCount > 1) { mprPrintf(http, "\n"); } mprPrintf(http, " Count Thread Op Code Bytes Url\n"); } mprPrintf(http, "%7d %7s %4s %5d %7d %s\n", fetchCount - 1, mprGetCurrentThreadName(http), method, code, contentLen, url); } }