Fixed a bug where non-successful HEAD response is assumed to have a message body
This commit is contained in:
parent
640fae7963
commit
d38219a85c
@ -120,11 +120,16 @@ public class HttpClientCodec implements ChannelUpstreamHandler,
|
||||
// current response.
|
||||
HttpMethod method = queue.poll();
|
||||
|
||||
// Successful HEAD and CONNECT result in empty body.
|
||||
// According to 4.3, RFC2616:
|
||||
// All responses to the HEAD request method MUST NOT include a
|
||||
// message-body, even though the presence of entity-header fields
|
||||
// might lead one to believe they do.
|
||||
if (HttpMethod.HEAD.equals(method)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Successful CONNECT result in empty body.
|
||||
if (((HttpResponse) msg).getStatus().getCode() == 200) {
|
||||
if (HttpMethod.HEAD.equals(method)) {
|
||||
return true;
|
||||
}
|
||||
if (HttpMethod.CONNECT.equals(method)) {
|
||||
// Proxy connection established - Not HTTP anymore.
|
||||
done = true;
|
||||
|
Loading…
Reference in New Issue
Block a user