src/SerifHTTPServer/HTTPConnection.cpp
// If there's an error, return the empty string.

If there's an error, return the empty string.
If there ' s an error return the empty string .
std::string HTTPConnection::decodeRequestURI(const std::string& encoded_uri) {
	std::stringstream decoded;
	for (size_t i=0; i<encoded_uri.size(); ++i) {
		if (encoded_uri[i] == '%') {
			if (i+3 <= encoded_uri.size()) {
				int value;
		        std::istringstream iss(encoded_uri.substr(i + 1, 2));
				if (iss >> std::hex >> value) {
					decoded << static_cast<char>(value);
					i += 2; 
				} else
					return "";
			} else 
				return "";
		}
		else if (encoded_uri[i] == '+')
			decoded << ' ';
		else
			decoded << encoded_uri[i];
	}
	return decoded.str();
}
std :: string HTTPConnection :: decodeRequestURI ( const std :: string & encoded_uri ) { std :: stringstream decoded ; for ( size_t i = 0 ; i < encoded_uri . size ( ) ; ++ i ) { if ( encoded_uri [ i ] == ' ' ) { if ( i + 3 <= encoded_uri . size ( ) ) { int value ; std :: istringstream iss ( encoded_uri . substr ( i + 1 , 2 ) ) ; if ( iss >> std :: hex >> value ) { decoded << static_cast < char > ( value ) ; i += 2 ; } else return " " ; } else return " " ; } else if ( encoded_uri [ i ] == ' ' ) decoded << ' ' ; else decoded << encoded_uri [ i ] ; } return decoded . str ( ) ; }
If there's an error, return the empty string.
If there ' s an error return the empty string .
// If we find a '%'-escaped character, then decode it.
 // Convert from hex -> int -> char
 // skip the characters we processed.
