Commit d7351289 authored by vagrant's avatar vagrant
Browse files

Bug fixed on codec search

parent ede104d3
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -375,8 +375,6 @@ int http_codec::decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValue

int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody& p_message_body, OCTETSTRING& p_encoding_buffer, const std::string& p_content_type) {
  loggers::get_instance().log_msg(">>> http_codec::encode_body: ", (const Base_Type&)p_message_body);
  loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this);
  loggers::get_instance().log("http_codec::encode_body: Content-type:'%s'", p_content_type.c_str());

  // Sanity check
  if (p_content_type.empty()) {
@@ -391,7 +389,7 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
    } else {
      std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
      bool processed = false;
      if (p_content_type.find_first_of("x-its") != std::string::npos) {
      if (p_content_type.find("x-its") != std::string::npos) {
        it = _codecs.find("http_its"); // TODO Use params
        if (it != _codecs.cend()) {
          loggers::get_instance().log("http_codec::encode_body: Call 'http_etsi_ieee1609dot2_codec'");
@@ -415,14 +413,16 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
    } else {
      std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
      bool processed = false;
      if (p_content_type.find_first_of("held") != std::string::npos) {
      loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this);
      loggers::get_instance().log("http_codec::encode_body: Content-type:'%s'", p_content_type.c_str());
      if (p_content_type.find("held") != std::string::npos) {
        it = _codecs.find("held"); // TODO Use params
        if (it != _codecs.cend()) {
          loggers::get_instance().log("http_codec::encode_body: Call 'held_codec'");
          _codecs["held"]->encode((Record_Type&)xml_body, p_encoding_buffer); // TODO Use params
          processed = true;
        }
      } else if (p_content_type.find_first_of("lost") != std::string::npos) {
      } else if (p_content_type.find("lost") != std::string::npos) {
        it = _codecs.find("lost"); // TODO Use params
        if (it != _codecs.cend()) {
          loggers::get_instance().log("http_codec::encode_body: Call 'lost_codec'");