示例#1
0
CGIParser::CGIParser(const HTTPRequest& request, bool queryOnly)
{
    parse(request.getQueryString());
    if (!queryOnly && !strcmp(request.getMethod(),"POST")) {
        if (request.getContentType().find("application/x-www-form-urlencoded") != string::npos)
            parse(request.getRequestBody());
    }
}
示例#2
0
CGIParser::CGIParser(const HTTPRequest& request)
{
    const char* pch=NULL;
    if (!strcmp(request.getMethod(),"POST"))
        pch=request.getRequestBody();
    else
        pch=request.getQueryString();
    size_t cl=pch ? strlen(pch) : 0;
    
    const URLEncoder* dec = XMLToolingConfig::getConfig().getURLEncoder();
    while (cl && pch) {
        char *name;
        char *value;
        value=fmakeword('&',&cl,&pch);
        plustospace(value);
        dec->decode(value);
        name=makeword(value,'=');
        kvp_map.insert(pair<const string,char*>(name,value));
        free(name);
    }
}