BreeeZe / rpos

Raspberry Pi Onvif Server
http://breeeze.github.io/rpos
MIT License
643 stars 146 forks source link

When there is Chinese in the soap body, Onvif Device Manager and wireshark will fail to parse it. #155

Open xueqing opened 1 year ago

xueqing commented 1 year ago
    // modify services/media_service.ts
    port.GetProfiles = (args, cb, headers) => {
      utils.log.info(`GetProfiles:`);

      const GetProfilesResponse = { Profiles: [] };

      let currentName = "中文";

      const profile = {
        Name: currentName,
        attributes: {
          token: 'currentToken'
        }
      };
      GetProfilesResponse.Profiles.push(profile);
      cb(GetProfilesResponse);
    };

ONVIF Device Test Tool will prompt an error message "An error occurred while receiving packet. Expected length: 642, received: 646". And wireshark will split soap response body with the second part showing “Unrecognized text”, while the “Unrecognized text” is exactly 4 bytes.

无标题

RogerHardiman commented 1 year ago

So it looks like the code that computes the length of the XML payload is incorrect.