isContentAlwaysEmpty() — netty Function Reference
Architecture documentation for the isContentAlwaysEmpty() function in HttpClientCodec.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 51f6d3de_fe54_872f_014f_2ef92399fa0e["isContentAlwaysEmpty()"] 71405c1a_689d_5893_0dd0_554c0d86697f["Decoder"] 51f6d3de_fe54_872f_014f_2ef92399fa0e -->|defined in| 71405c1a_689d_5893_0dd0_554c0d86697f style 51f6d3de_fe54_872f_014f_2ef92399fa0e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java lines 341–405
@Override
protected boolean isContentAlwaysEmpty(HttpMessage msg) {
// Get the method of the HTTP request that corresponds to the
// current response.
//
// Even if we do not use the method to compare we still need to poll it to ensure we keep
// request / response pairs in sync.
HttpMethod method = queue.poll();
final HttpResponseStatus status = ((HttpResponse) msg).status();
final HttpStatusClass statusClass = status.codeClass();
final int statusCode = status.code();
if (statusClass == HttpStatusClass.INFORMATIONAL) {
// An informational response should be excluded from paired comparison.
// Just delegate to super method which has all the needed handling.
return super.isContentAlwaysEmpty(msg);
}
// If the remote peer did for example send multiple responses for one request (which is not allowed per
// spec but may still be possible) method will be null so guard against it.
if (method != null) {
char firstChar = method.name().charAt(0);
switch (firstChar) {
case 'H':
// 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;
// The following code was inserted to work around the servers
// that behave incorrectly. It has been commented out
// because it does not work with well behaving servers.
// Please note, even if the 'Transfer-Encoding: chunked'
// header exists in the HEAD response, the response should
// have absolutely no content.
//
//// Interesting edge case:
//// Some poorly implemented servers will send a zero-byte
//// chunk if Transfer-Encoding of the response is 'chunked'.
////
//// return !msg.isChunked();
}
break;
case 'C':
// Successful CONNECT request results in a response with empty body.
if (statusCode == 200) {
if (HttpMethod.CONNECT.equals(method)) {
// Proxy connection established - Parse HTTP only if configured by
// parseHttpAfterConnectRequest, else pass through.
if (!parseHttpAfterConnectRequest) {
done = true;
queue.clear();
}
return true;
}
}
break;
default:
break;
}
}
return super.isContentAlwaysEmpty(msg);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does isContentAlwaysEmpty() do?
isContentAlwaysEmpty() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java.
Where is isContentAlwaysEmpty() defined?
isContentAlwaysEmpty() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java at line 341.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free