--- /data/kaffesrc/kaffe-snap-20010819/libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection_old.java Mon Nov 26 09:57:46 2001 +++ /data/kaffesrc/kaffe-snap-20010819/libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection.java Wed Nov 21 08:56:37 2001 @@ -159,9 +159,20 @@ int pos = line.indexOf(':'); if (pos > 0) { String key = line.substring(0, pos); - for (pos++; Character.isWhitespace(line.charAt(pos)); pos++) + // Modified to handle cases where the line ends in ':' which could lead to StringIndexOutOfBoundsException. Modified date 20th Nov 2001. + //for (pos++; Character.isWhitespace(line.charAt(pos)); pos++) + for (pos++; (pos < line.length()) && Character.isWhitespace(line.charAt(pos)); pos++) ; - String val = line.substring(pos); + // Modified to handle cases where the line ends in ':' which could lead to StringIndexOutOfBoundsException. Modified date 20th Nov 2001. + //String val = line.substring(pos); + String val; + if(pos < line.length()) { + val = line.substring(pos); + } + else { + val = ""; + } + // due to above modification on 20th Nov 2001 there may be a case where val could result in ""; NO idea about the consequence of this and whether this corresponds to Http-Specifications (zero-length string as value for a header). setHeaderField(key, val); } }