mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-26 08:35:32 +08:00
re PR classpath/28580 (HTTP HEAD fails on chuncked encoding)
PR classpath/28580 * gnu/java/net/protocol/http/Request.java (readResponse): Call createResponseBodyStream in more cases and with new parameter. (createResponseBodyStream): Added new parameter mayHaveBody. Handle HEAD and !mayHaveBody responses specially. From-SVN: r116853
This commit is contained in:
parent
d295200882
commit
5a4ba983b8
@ -1,3 +1,11 @@
|
||||
2006-09-11 David Daney <ddaney@avtrex.com>
|
||||
|
||||
PR classpath/28580
|
||||
* gnu/java/net/protocol/http/Request.java (readResponse): Call
|
||||
createResponseBodyStream in more cases and with new parameter.
|
||||
(createResponseBodyStream): Added new parameter mayHaveBody. Handle
|
||||
HEAD and !mayHaveBody responses specially.
|
||||
|
||||
2006-09-05 Gary Benson <gbenson@redhat.com>
|
||||
|
||||
* java/net/SocketPermission.java
|
||||
|
@ -419,13 +419,16 @@ public class Request
|
||||
switch (code)
|
||||
{
|
||||
case 100:
|
||||
break;
|
||||
case 204:
|
||||
case 205:
|
||||
case 304:
|
||||
body = createResponseBodyStream(responseHeaders, majorVersion,
|
||||
minorVersion, in, false);
|
||||
break;
|
||||
default:
|
||||
body = createResponseBodyStream(responseHeaders, majorVersion,
|
||||
minorVersion, in);
|
||||
minorVersion, in, true);
|
||||
}
|
||||
|
||||
// Construct response
|
||||
@ -453,7 +456,8 @@ public class Request
|
||||
private InputStream createResponseBodyStream(Headers responseHeaders,
|
||||
int majorVersion,
|
||||
int minorVersion,
|
||||
InputStream in)
|
||||
InputStream in,
|
||||
boolean mayHaveBody)
|
||||
throws IOException
|
||||
{
|
||||
long contentLength = -1;
|
||||
@ -466,7 +470,12 @@ public class Request
|
||||
(majorVersion == 1 && minorVersion == 0);
|
||||
|
||||
String transferCoding = responseHeaders.getValue("Transfer-Encoding");
|
||||
if ("chunked".equalsIgnoreCase(transferCoding))
|
||||
if ("HEAD".equals(method) || !mayHaveBody)
|
||||
{
|
||||
// Special case no body.
|
||||
in = new LimitedLengthInputStream(in, 0, true, connection, doClose);
|
||||
}
|
||||
else if ("chunked".equalsIgnoreCase(transferCoding))
|
||||
{
|
||||
in = new LimitedLengthInputStream(in, -1, false, connection, doClose);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user