blob: 5c983c3dc11d5346fce8da17dc177a3f55136e73 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# HG changeset patch
# User dmocek
# Date 1353367979 28800
# Node ID 49a37df9e80fae205a7b70d862cd303a62049c2c
# Parent 2281f5670cc599f0fe97c880cdceb6a7db837dc3
8001242: Improve RMI HTTP conformance
Reviewed-by: ahgross, mchung, smarks
diff --git a/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java b/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
--- jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
+++ jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
@@ -285,11 +285,14 @@ final class CGIForwardCommand implements
"unexpected EOF reading server response");
if (line.toLowerCase().startsWith(key)) {
- if (contentLengthFound)
- ; // what would we want to do in this case??
- responseContentLength =
- Integer.parseInt(line.substring(key.length()).trim());
- contentLengthFound = true;
+ if (contentLengthFound) {
+ throw new CGIServerException(
+ "Multiple Content-length entries found.");
+ } else {
+ responseContentLength =
+ Integer.parseInt(line.substring(key.length()).trim());
+ contentLengthFound = true;
+ }
}
} while ((line.length() != 0) &&
(line.charAt(0) != '\r') && (line.charAt(0) != '\n'));
diff --git a/src/share/classes/sun/rmi/transport/proxy/HttpInputStream.java b/src/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
--- jdk/src/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
+++ jdk/src/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -70,11 +70,14 @@ class HttpInputStream extends FilterInpu
throw new EOFException();
if (line.toLowerCase().startsWith(key)) {
- if (contentLengthFound)
- ; // what would we want to do in this case??
- bytesLeft =
- Integer.parseInt(line.substring(key.length()).trim());
- contentLengthFound = true;
+ if (contentLengthFound) {
+ throw new IOException(
+ "Multiple Content-length entries found.");
+ } else {
+ bytesLeft =
+ Integer.parseInt(line.substring(key.length()).trim());
+ contentLengthFound = true;
+ }
}
// The idea here is to go past the first blank line.
|