Fixed a bug where RtspResponseDecoder does not decode a response with no 'Content-Length' header properly

This commit is contained in:
Trustin Lee 2010-05-19 07:42:21 +00:00
parent 3847fb00e5
commit 0c9202ab75

View File

@ -80,6 +80,20 @@ public class RtspResponseDecoder extends RtspMessageDecoder {
new HttpResponseStatus(Integer.valueOf(initialLine[1]), initialLine[2]));
}
@Override
protected boolean isContentAlwaysEmpty(HttpMessage msg) {
// Unlike HTTP, RTSP always assumes zero-length body if Content-Length
// header is absent.
boolean empty = super.isContentAlwaysEmpty(msg);
if (empty) {
return true;
}
if (!msg.containsHeader(RtspHeaders.Names.CONTENT_LENGTH)) {
return true;
}
return empty;
}
@Override
protected boolean isDecodingRequest() {
return false;