1026 ns = new BigInteger(1, nonce).toString(16); |
1026 ns = new BigInteger(1, nonce).toString(16); |
1027 } |
1027 } |
1028 |
1028 |
1029 @Override |
1029 @Override |
1030 protected void requestAuthentication(HttpTestExchange he) |
1030 protected void requestAuthentication(HttpTestExchange he) |
1031 throws IOException { |
1031 throws IOException { |
|
1032 String separator; |
|
1033 Version v = he.getExchangeVersion(); |
|
1034 if (v == Version.HTTP_1_1) { |
|
1035 separator = "\r\n "; |
|
1036 } else if (v == Version.HTTP_2) { |
|
1037 separator = " "; |
|
1038 } else { |
|
1039 throw new InternalError(String.valueOf(v)); |
|
1040 } |
1032 he.getResponseHeaders().addHeader(getAuthenticate(), |
1041 he.getResponseHeaders().addHeader(getAuthenticate(), |
1033 "Digest realm=\"" + auth.getRealm() + "\"," |
1042 "Digest realm=\"" + auth.getRealm() + "\"," |
1034 + "\r\n qop=\"auth\"," |
1043 + separator + "qop=\"auth\"," |
1035 + "\r\n nonce=\"" + ns +"\""); |
1044 + separator + "nonce=\"" + ns +"\""); |
1036 System.out.println(type + ": Requesting Digest Authentication " |
1045 System.out.println(type + ": Requesting Digest Authentication " |
1037 + he.getResponseHeaders() |
1046 + he.getResponseHeaders() |
1038 .firstValue(getAuthenticate()) |
1047 .firstValue(getAuthenticate()) |
1039 .orElse("null")); |
1048 .orElse("null")); |
1040 } |
1049 } |