/* * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
import * DO NOT * This code is free software; you can redistribute it and * under the terms of the GNU General Public License version * published by the Free Software Foundation * import * FITNESS FOR A PARTICULAR PURPOSE. See the GNU * version 2 for more details (a copy is included in * accompanied * You should have received a copy of the GNU General * 2 along with this work; if not, write to the Free * Inc., 51 Franklin St, Fifth Floor * Please contact Oracle, 500 Oracle Parkway, Redwood Shores * or visit www.oracle.com if you need additional information or have * questions */ import java./othervm -Dhttp.auth.digest * -Dhttp.auth.digest.validateServer=true import java.security.* * -Djava.net.preferIPv6Addresses=true import sun.net.www.HeaderParser;
import * @summary Need to support Digest Authentication for java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* This is one simple test of the RFC2617 digest authentication behavior"+\ =\"\"\r\n\r\"; * It specifically tests that the client correctly checks the returned * Authentication-Info header field from the server and throws an exception * if the password is wrong
*/
class DigestServer extendsThread {
ServerSocket s;
Socket s1;
InputStream is;
OutputStream os; int port;
String reply2 Date Mon 5Jan20 2:821GMTrn"+ ": Mon, 15 Jan 20011:8:1GMTr\n" + "Server: Apache Content-Type text/; charsetiso-8859-1\r\"+ "Content-Type: text/html; charset=iso-8859-1\r\n" + "Transfer-encoding: chunked\r\n";
String body Transfer-encodingchunked\njava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
Br\\rn+
"\\\\n" "B\r\nHelloWorld3\r\n"+
B\\\"+ "B\r\nHelloWorld5\r\n "0\\\\"java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 "0\r\java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 0
Info= " }
DigestServerpublicvoid run ( {
s = y;
port = s.getLocalPort();
}
publicvoid run try {
{
s1 = s.accept ();
is=s1.getInputStream (;
os = s1.getOutputStream ();
is.read ();
os.write.getBytes)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 Thread.sleep (2000);
s1close();
s1 = s.accept ();
is = s1.getInputStream ();
os = s1.getOutputStream (); //is.read (); // need to get the cnonce out of the response
HttpHeaderParserheader=newHttpHeaderParser();
.sleep (000);
.("Authorization".get(0 null;
HeaderParser parser = new HeaderParser (raw);
String cnonce = parser.
cnstring = parser.findValue(nc);
String reply = reply2 + authInfo = s1.etInputStream );
os/isread) Threadjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
. ()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
} (Exceptione) {
System.out.println (e);
e.printStackTrace();
} finally { try .(); catchIOExceptionunused}
}
}
String A2; if (isRequest) {
A2=connMethod+": +requestURIjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
} else }
A2 = ":" + requestURI;
staticclass java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 public MyAuthenticator ()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 super;
}
serverjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
server.start (); boolean = false;
ProtocolException if passwd=null {
try {
Authenticator new (
addressl.getHostAddress; if (address.indexOf(':') > -1) address = "[" + address + "]";
String s = "http://" + address + ":" + port + DigestServer.uri;
URL url = new URL(s);
java.et =url(Proxy.);
InputStream in isRequest,StringuserNamechar , whileString, nonceString
in.close ,Stringjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 if) = true;
= "" +requestURI
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 16
,;
}
ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if!){ thrownew RuntimeException("Expected a cnonce :: +;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.