src/services/httpparsing.cpp
/**
 * Parses POST data from a HTTP request
 */
Parses POST data from a HTTP request
Parses POST data from a HTTP request
void parsePostData(Parameters &params, std::istream &in) {
	std::string request_method = getenv_str("REQUEST_METHOD", false);
	if (request_method != "POST")
		return;
	std::string content_type = getenv_str("CONTENT_TYPE", true);
	std::string content_length_string = getenv_str("CONTENT_LENGTH", false);
	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 ) { std :: string request_method = getenv_str ( " " , false ) ; if ( request_method != " " ) return ; std :: string content_type = getenv_str ( " " , true ) ; std :: string content_length_string = getenv_str ( " " , false ) ; 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
Parses POST data from a HTTP request
// Methods are always case-sensitive (RFC 2616 ch. 5.1.1) // HTTP header fields are always case-insensitive (RFC 2616 ch. 4.2)