diff --git a/ccsrc/Protocols/Http/http_codec.cc b/ccsrc/Protocols/Http/http_codec.cc index cdf4ab7e4303b92ec0534b5929613503d47cf1af..c0fac4c86bcb767fbaaf487f6a4421d2b61cb2fc 100644 --- a/ccsrc/Protocols/Http/http_codec.cc +++ b/ccsrc/Protocols/Http/http_codec.cc @@ -113,6 +113,8 @@ int http_codec::decode(const OCTETSTRING &data, LibHttp__TypesAndValues::HttpMes LibHttp__TypesAndValues::Headers headers; std::string content_type; decode_headers(decoding_buffer, headers, content_type); + loggers::get_instance().log("http_codec::decode: _dc.length=%d", _dc.length); + loggers::get_instance().log("http_codec::decode: decoding_buffer.get_len()=%d", decoding_buffer.get_len()); if (_dc.length > decoding_buffer.get_len()) { // HTTP response is fragmented // Need to bufferize the first packet and wait for the other fragments tp be received loggers::get_instance().warning("http_codec::decode: Need to bufferize the first packet and wait for the other fragments tp be received"); @@ -417,8 +419,12 @@ int http_codec::decode_headers(TTCN_Buffer &decoding_buffer, LibHttp__TypesAndVa } break; case 1: if (headers.is_bound()) { - loggers::get_instance().log_msg("<<< http_codec::decode_headers: ", headers); - return 0; + if (_dc.length == -1) { // content-Length header not found, force length to 0, assuming no body is present + loggers::get_instance().log("http_codec::decode_headers: Force _dc.length to 0"); + _dc.length = 0; + } + loggers::get_instance().log_msg("<<< http_codec::decode_headers: ", headers); + return 0; } else { loggers::get_instance().warning("http_codec::decode_headers: Failed to decode headers"); return -1; @@ -431,7 +437,7 @@ int http_codec::decode_headers(TTCN_Buffer &decoding_buffer, LibHttp__TypesAndVa } int http_codec::decode_header(CHARSTRING &header_line, LibHttp__TypesAndValues::Header &header) { - loggers::get_instance().log_msg(">>> http_codec::decode_header", header_line); + loggers::get_instance().log_msg(">>> http_codec::decode_header: ", header_line); try { std::string str(static_cast<const char *>(header_line));