src/HTTPClient/DefaultAuthHandler.java
/**
     * Calc "response" attribute for a request.
     */
Calc "response" attribute for a request.
Calc " response " attribute for a request .
private static String calcResponseAttr(String hash, String[] extra,
					   NVPair[] params, int alg,
					   int uri, int qop, int nonce,
					   int nc, int cnonce, String method)
    {
	String A1, A2, resp_val;
	if (alg != -1  &&
	    params[alg].getValue().equalsIgnoreCase("MD5-sess"))
	    A1 = extra[DI_A1S];
	else
	    A1 = extra[DI_A1];
	A2 = method + ":" + params[uri].getValue();
	if (qop != -1  &&
	    params[qop].getValue().equalsIgnoreCase("auth-int"))
	{
	    A2 += ":" + hash;
	}
	A2 = MD5.hexDigest(A2);
	if (qop == -1)
	    resp_val =
		MD5.hexDigest(A1 + ":" + params[nonce].getValue() + ":" + A2);
	else
	    resp_val =
		MD5.hexDigest(A1 + ":" + params[nonce].getValue() + ":" +
			      params[nc].getValue() + ":" +
			      params[cnonce].getValue() + ":" +
			      params[qop].getValue() + ":" + A2);
	return resp_val;
    }
private static String calcResponseAttr ( String hash , String [ ] extra , NVPair [ ] params , int alg , int uri , int qop , int nonce , int nc , int cnonce , String method ) { String A1 , A2 , resp_val ; if ( alg != - 1 && params [ alg ] . getValue ( ) . equalsIgnoreCase ( "MD5-sess" ) ) A1 = extra [ DI_A1S ] ; else A1 = extra [ DI_A1 ] ; A2 = method + ":" + params [ uri ] . getValue ( ) ; if ( qop != - 1 && params [ qop ] . getValue ( ) . equalsIgnoreCase ( "auth-int" ) ) { A2 += ":" + hash ; } A2 = MD5 . hexDigest ( A2 ) ; if ( qop == - 1 ) resp_val = MD5 . hexDigest ( A1 + ":" + params [ nonce ] . getValue ( ) + ":" + A2 ) ; else resp_val = MD5 . hexDigest ( A1 + ":" + params [ nonce ] . getValue ( ) + ":" + params [ nc ] . getValue ( ) + ":" + params [ cnonce ] . getValue ( ) + ":" + params [ qop ] . getValue ( ) + ":" + A2 ) ; return resp_val ; }
Calc "response" attribute for a request.
Calc " response " attribute for a request .