Bug for cameras that do not specify content length

Forum for questions and support relating to the 1.30.x releases only.
Locked
null_glitch
Posts: 1
Joined: Mon Nov 07, 2016 2:37 am

Bug for cameras that do not specify content length

Post by null_glitch »

The code in the src/zm_remote_camera_http.cpp does not work with a HTTP request camera I am using.

Specifically the zmc_m1 always says ERR [Unable to read content]. I would recommend that there are 4 different instances of this exact error log in the source file -- and it would be helpful if they were slightly different (like 1,2,3,4 in the error). But I tracked down the root cause to be on or around like 503:

while ( ! ( buffer_len = ReadData( buffer ) ) ) {
}
- if ( buffer_len < 0 ) {
+ if ( buffer.size() < 0 ) {
Error( "Unable to read content(2) - already read=%d", (int)buffer.size());
return( -1 );
}
static RegExpr *content_expr = 0;

Checking the buffer_len result should ALWAYS be -1 because we are reading until that buffer is empty. So the correct code would be to check that something was read into the buffer as "not an error". I'm not really setup to fully submit patches, so I hope someone else who sees this can add it into the trunk.
Locked