src/services/httpparsing.cpp
/**
 * Parses POST data from a HTTP request FCGI
 */
Parses POST data from a HTTP request FCGI
Parses POST data from a HTTP request FCGI
void parsePostData(Parameters &params, std::istream &in, FCGX_Request &request) {
	std::string request_method = getFCGIParam(request, "REQUEST_METHOD");
	if (request_method != "POST")
		return;
	std::string content_type = getFCGIParam(request, "CONTENT_TYPE");
	std::transform(content_type.begin(), content_type.end(), content_type.begin(), ::tolower);
	std::string content_length_string = getFCGIParam(request, "CONTENT_LENGTH");
	int content_length = std::stoi(content_length_string);
	if (content_type == "application/x-www-form-urlencoded") {
		parsePostUrlEncoded(params, in, content_length);
	} else if (content_type.find("multipart/form-data") != std::string::npos || content_type.find("multipart/mixed") != std::string::npos) {
        throw ArgumentException("For multipart POST request call getMultipartPostDataReader.");
	} else
		throw ArgumentException("Unknown content type in POST request.");
}
void parsePostData ( Parameters & params , std :: istream & in , FCGX_Request & request ) { std :: string request_method = getFCGIParam ( request , " " ) ; if ( request_method != " " ) return ; std :: string content_type = getFCGIParam ( request , " " ) ; std :: transform ( content_type . begin ( ) , content_type . end ( ) , content_type . begin ( ) , :: tolower ) ; std :: string content_length_string = getFCGIParam ( request , " " ) ; int content_length = std :: stoi ( content_length_string ) ; if ( content_type == " " ) { parsePostUrlEncoded ( params , in , content_length ) ; } else if ( content_type . find ( " " ) != std :: string :: npos || content_type . find ( " " ) != std :: string :: npos ) { throw ArgumentException ( " " ) ; } else throw ArgumentException ( " " ) ; }
Parses POST data from a HTTP request FCGI
Parses POST data from a HTTP request FCGI
// Methods are always case-sensitive (RFC 2616 ch. 5.1.1) // HTTP header fields are always case-insensitive (RFC 2616 ch. 4.2)