Loading ccsrc/Protocols/Http/http_codec.cc +26 −3 Original line number Original line Diff line number Diff line Loading @@ -117,7 +117,7 @@ int http_codec::decode(const OCTETSTRING &data, LibHttp__TypesAndValues::HttpMes loggers::get_instance().log("http_codec::decode: decoding_buffer.get_len()=%d", decoding_buffer.get_len()); 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 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 // 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"); loggers::get_instance().warning("http_codec::decode: Need to bufferize the first packet and wait for the other fragments to be received"); // Set counters // Set counters loggers::get_instance().log("http_codec::decode: Set bufferization counters"); loggers::get_instance().log("http_codec::decode: Set bufferization counters"); _initial_content_length = _dc.length; _initial_content_length = _dc.length; Loading Loading @@ -177,7 +177,30 @@ int http_codec::decode(const OCTETSTRING &data, LibHttp__TypesAndValues::HttpMes LibHttp__TypesAndValues::Headers headers; LibHttp__TypesAndValues::Headers headers; std::string content_type; std::string content_type; decode_headers(decoding_buffer, headers, content_type); decode_headers(decoding_buffer, headers, content_type); loggers::get_instance().log("http_codec::decode (request): _dc.length=%d", _dc.length); loggers::get_instance().log("http_codec::decode (request): 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 (request): Need to bufferize the first packet and wait for the other fragments to be received"); // Set counters loggers::get_instance().log("http_codec::decode (request): Set bufferization counters"); _initial_content_length = _dc.length; _current_content_length = 0; _bufferized_buffers.push_back(data); _current_content_length += data.lengthof(); loggers::get_instance().log("http_codec::decode (request): _bufferized_buffers size: %d - _current_content_length: %d", _bufferized_buffers.size(), _current_content_length); return -2; } else { // Force reset counters loggers::get_instance().log("http_codec::decode (request): Force reset bufferization counters"); _initial_content_length = 0; _current_content_length = 0; } request.header() = headers; request.header() = headers; loggers::get_instance().log_to_hexa("Before decoding Body (request): ", decoding_buffer); loggers::get_instance().log("http_codec::decode (request): _initial_content_length = %d", _initial_content_length); loggers::get_instance().log("http_codec::decode (request): headers().content_length (_dc.length) = %d - decoding_buffer.get_len() = %d", _dc.length, decoding_buffer.get_len()); OPTIONAL<LibHttp__MessageBodyTypes::HttpMessageBody> body; OPTIONAL<LibHttp__MessageBodyTypes::HttpMessageBody> body; body.set_to_omit(); body.set_to_omit(); if (decode_body(decoding_buffer, body, content_type) == -1) { if (decode_body(decoding_buffer, body, content_type) == -1) { Loading Loading @@ -459,11 +482,11 @@ int http_codec::decode_header(CHARSTRING &header_line, LibHttp__TypesAndValues:: } // End of 'for' statement } // End of 'for' statement header.header__value() = OPTIONAL<LibHttp__TypesAndValues::charstring__list>(v); header.header__value() = OPTIONAL<LibHttp__TypesAndValues::charstring__list>(v); if (m[1].str().compare("Content-Length") == 0) { if ((m[1].str().compare("Content-Length") == 0) || (m[1].str().compare("content-length")) == 0) { // Save the the body length // Save the the body length loggers::get_instance().log("http_codec::decode_header: decoded Content-Length %s", m[2].str().c_str()); loggers::get_instance().log("http_codec::decode_header: decoded Content-Length %s", m[2].str().c_str()); _dc.length = std::stoi(m[2].str()); _dc.length = std::stoi(m[2].str()); } else if (m[1].str().compare("Transfer-Encoding") == 0) { } else if ((m[1].str().compare("Transfer-Encoding") == 0) || (m[1].str().compare("transfer-encoding"))) { if (m[2].str().find("chunked") != std::string::npos) { if (m[2].str().find("chunked") != std::string::npos) { _dc.chunked = true; _dc.chunked = true; loggers::get_instance().log("http_codec::decode_header: decoded Transfer-Encoding %x", _dc.chunked); loggers::get_instance().log("http_codec::decode_header: decoded Transfer-Encoding %x", _dc.chunked); Loading Loading
ccsrc/Protocols/Http/http_codec.cc +26 −3 Original line number Original line Diff line number Diff line Loading @@ -117,7 +117,7 @@ int http_codec::decode(const OCTETSTRING &data, LibHttp__TypesAndValues::HttpMes loggers::get_instance().log("http_codec::decode: decoding_buffer.get_len()=%d", decoding_buffer.get_len()); 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 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 // 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"); loggers::get_instance().warning("http_codec::decode: Need to bufferize the first packet and wait for the other fragments to be received"); // Set counters // Set counters loggers::get_instance().log("http_codec::decode: Set bufferization counters"); loggers::get_instance().log("http_codec::decode: Set bufferization counters"); _initial_content_length = _dc.length; _initial_content_length = _dc.length; Loading Loading @@ -177,7 +177,30 @@ int http_codec::decode(const OCTETSTRING &data, LibHttp__TypesAndValues::HttpMes LibHttp__TypesAndValues::Headers headers; LibHttp__TypesAndValues::Headers headers; std::string content_type; std::string content_type; decode_headers(decoding_buffer, headers, content_type); decode_headers(decoding_buffer, headers, content_type); loggers::get_instance().log("http_codec::decode (request): _dc.length=%d", _dc.length); loggers::get_instance().log("http_codec::decode (request): 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 (request): Need to bufferize the first packet and wait for the other fragments to be received"); // Set counters loggers::get_instance().log("http_codec::decode (request): Set bufferization counters"); _initial_content_length = _dc.length; _current_content_length = 0; _bufferized_buffers.push_back(data); _current_content_length += data.lengthof(); loggers::get_instance().log("http_codec::decode (request): _bufferized_buffers size: %d - _current_content_length: %d", _bufferized_buffers.size(), _current_content_length); return -2; } else { // Force reset counters loggers::get_instance().log("http_codec::decode (request): Force reset bufferization counters"); _initial_content_length = 0; _current_content_length = 0; } request.header() = headers; request.header() = headers; loggers::get_instance().log_to_hexa("Before decoding Body (request): ", decoding_buffer); loggers::get_instance().log("http_codec::decode (request): _initial_content_length = %d", _initial_content_length); loggers::get_instance().log("http_codec::decode (request): headers().content_length (_dc.length) = %d - decoding_buffer.get_len() = %d", _dc.length, decoding_buffer.get_len()); OPTIONAL<LibHttp__MessageBodyTypes::HttpMessageBody> body; OPTIONAL<LibHttp__MessageBodyTypes::HttpMessageBody> body; body.set_to_omit(); body.set_to_omit(); if (decode_body(decoding_buffer, body, content_type) == -1) { if (decode_body(decoding_buffer, body, content_type) == -1) { Loading Loading @@ -459,11 +482,11 @@ int http_codec::decode_header(CHARSTRING &header_line, LibHttp__TypesAndValues:: } // End of 'for' statement } // End of 'for' statement header.header__value() = OPTIONAL<LibHttp__TypesAndValues::charstring__list>(v); header.header__value() = OPTIONAL<LibHttp__TypesAndValues::charstring__list>(v); if (m[1].str().compare("Content-Length") == 0) { if ((m[1].str().compare("Content-Length") == 0) || (m[1].str().compare("content-length")) == 0) { // Save the the body length // Save the the body length loggers::get_instance().log("http_codec::decode_header: decoded Content-Length %s", m[2].str().c_str()); loggers::get_instance().log("http_codec::decode_header: decoded Content-Length %s", m[2].str().c_str()); _dc.length = std::stoi(m[2].str()); _dc.length = std::stoi(m[2].str()); } else if (m[1].str().compare("Transfer-Encoding") == 0) { } else if ((m[1].str().compare("Transfer-Encoding") == 0) || (m[1].str().compare("transfer-encoding"))) { if (m[2].str().find("chunked") != std::string::npos) { if (m[2].str().find("chunked") != std::string::npos) { _dc.chunked = true; _dc.chunked = true; loggers::get_instance().log("http_codec::decode_header: decoded Transfer-Encoding %x", _dc.chunked); loggers::get_instance().log("http_codec::decode_header: decoded Transfer-Encoding %x", _dc.chunked); Loading