8001242: Improve RMI HTTP conformance

Reviewed-by: ahgross, mchung, smarks
This commit is contained in:
Darryl Mocek 2012-11-19 15:38:56 -08:00
parent 52caa8646b
commit 103aa32912
2 changed files with 17 additions and 11 deletions

View File

@ -293,12 +293,15 @@ final class CGIForwardCommand implements CGICommandHandler {
"unexpected EOF reading server response"); "unexpected EOF reading server response");
if (line.toLowerCase().startsWith(key)) { if (line.toLowerCase().startsWith(key)) {
// if contentLengthFound is true if (contentLengthFound) {
// we should probably do something here throw new CGIServerException(
"Multiple Content-length entries found.");
} else {
responseContentLength = responseContentLength =
Integer.parseInt(line.substring(key.length()).trim()); Integer.parseInt(line.substring(key.length()).trim());
contentLengthFound = true; contentLengthFound = true;
} }
}
} while ((line.length() != 0) && } while ((line.length() != 0) &&
(line.charAt(0) != '\r') && (line.charAt(0) != '\n')); (line.charAt(0) != '\r') && (line.charAt(0) != '\n'));

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -70,12 +70,15 @@ class HttpInputStream extends FilterInputStream {
throw new EOFException(); throw new EOFException();
if (line.toLowerCase().startsWith(key)) { if (line.toLowerCase().startsWith(key)) {
// if contentLengthFound is true if (contentLengthFound) {
// we should probably do something here throw new IOException(
"Multiple Content-length entries found.");
} else {
bytesLeft = bytesLeft =
Integer.parseInt(line.substring(key.length()).trim()); Integer.parseInt(line.substring(key.length()).trim());
contentLengthFound = true; contentLengthFound = true;
} }
}
// The idea here is to go past the first blank line. // The idea here is to go past the first blank line.
// Some DataInputStream.readLine() documentation specifies that // Some DataInputStream.readLine() documentation specifies that