public static Map<String,String> parseDigestAuthorizationChallenge( String line ) {

	Map<String,String> map = new TreeMap<String,String>( CaseInsensitiveComparator.sharedInstance );

	// This regex works but includes the quotes in the final result.
	// The line will be splitted into the single '<key>=<value>' elements by this regex.
	Pattern regex = Pattern.compile( "[^\\s]+=([^\\s\"']+|\"[^\"]*\"|'[^']*')" );


	Matcher regexMatcher = regex.matcher( line );
	while( regexMatcher.find() ) {

	    String token = regexMatcher.group();

	    // Remove comma?
	    if( token.endsWith(",") )
		token = token.substring(0,token.length()-1);

	    // Split at '='
	    int index = token.indexOf("=");
	    if( index == -1 ) {

		// A single '<key>' (without '=<value>')
		map.put( token, null );

	    } else if( index+1 >= token.length() ) {

		// A '<key>' with '=' but without '<value>'
		map.put( token.substring(0,index).trim(), "" );

	    } else {

		// A full '<key>=<value>' pair.

		String key   = token.substring(0,index).trim();
		String value = token.substring(index+1,token.length()).trim();
		
		// Remove quotes?	    
		/*if( value.length() >= 2 
		    && ( ( value.startsWith("\"") && value.endsWith("\"") )
			 ||
			 ( value.startsWith("'") && value.endsWith("'") ) 
			 ) ) {

		    value = value.substring( 1, value.length()-1 );
		}
		*/
		value = stripQuotes( value );

		map.put( key, value );
	    
	    }


	} 
	
	return map;
    }