@@ -849,6 +849,9 @@ void hio_set_unpack(hio_t* io, unpack_setting_t* setting) {
assert(io->unpack_setting->body_offset >=
io->unpack_setting->length_field_offset +
io->unpack_setting->length_field_bytes);
+ if (io->unpack_setting->length_field_coding == 0) {
+ io->unpack_setting->length_field_coding = ENCODE_BY_BIG_ENDIAN;
+ }
}
// NOTE: unpack must have own readbuf
@@ -139,6 +139,11 @@ int hio_unpack_by_length_field(hio_t* io, void* buf, int readbytes) {
return -1;
head_len = setting->body_offset + varint_bytes - setting->length_field_bytes;
+ } else {
+ hloge("Unknown length_field_coding!");
+ io->error = ERR_INVALID_PARAM;
+ hio_close(io);
+ return -1;
package_len = head_len + body_len + setting->length_adjustment;
if (remain >= package_len) {