Commit a9447fc4 authored by Yann Garcia's avatar Yann Garcia
Browse files

Bug fixed in CBOR

parent 7893c078
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -310,7 +310,7 @@ void http_layer::receive_data(OCTETSTRING &p_data, params &params) {
            params.insert(std::pair<std::string, std::string>(static_cast<const char*>(http_message.response().header()[i].header__name()), v[0]));
            std::string h = static_cast<const char*>(http_message.response().header()[i].header__name());
            // Override the serialization parameter according to the Content-Type header if it is not set yet
            if ((os.lengthof() == 0) && ((h.compare("Content-Type") == 0) || (h.compare("Content-type") == 0) || (h.compare("content-type") == 0))) { // Force the serialization parameter to be set according to the Content-Type header
            if ((os.lengthof() == 0 || params[params::serialization] == "binary") && ((h.compare("Content-Type") == 0) || (h.compare("Content-type") == 0) || (h.compare("content-type") == 0))) { // Force the serialization parameter to be set according to the Content-Type header — "binary" is the generic BinaryBody label (raw bytes with no known sub-protocol); refine it via Content-Type just like the "os still empty" case, since e.g. CBOR bodies always land here (non-printable bytes) but need their real serialization identified for codec dispatch.
              std::string s = std::string(static_cast<const char*>(v[0]));
              if (s.find("json") != std::string::npos) {
                loggers::get_instance().warning("http_layer::receive_data: Force serialization to json");
@@ -398,7 +398,7 @@ void http_layer::receive_data(OCTETSTRING &p_data, params &params) {
            params.insert(std::pair<std::string, std::string>(static_cast<const char*>(http_message.request().header()[i].header__name()), v[0]));
            std::string h = static_cast<const char*>(http_message.request().header()[i].header__name());            
            // Override the serialization parameter according to the Content-Type header if it is not set yet
            if ((os.lengthof() == 0) && ((h.compare("Content-Type") == 0) || (h.compare("Content-type") == 0) || (h.compare("content-type") == 0))) { // Force the serialization parameter to be set according to the Content-Type header
            if ((os.lengthof() == 0 || params[params::serialization] == "binary") && ((h.compare("Content-Type") == 0) || (h.compare("Content-type") == 0) || (h.compare("content-type") == 0))) { // Force the serialization parameter to be set according to the Content-Type header — "binary" is the generic BinaryBody label (raw bytes with no known sub-protocol); refine it via Content-Type just like the "os still empty" case, since e.g. CBOR bodies always land here (non-printable bytes) but need their real serialization identified for codec dispatch.
              std::string s = std::string(static_cast<const char*>(v[0]));
              if (s.find("json") != std::string::npos) {
                loggers::get_instance().warning("http_layer::receive_data: Force serialization to json");