Edimax IP cameras

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
lelik1
Posts: 1
Joined: Tue Jan 10, 2017 10:19 pm

Edimax IP cameras

Post by lelik1 »

Good day. I am a happy zm user since 2011. Back then, installing zm took couple days and could be done only from source. It required about 7 custom patches just to work. Recently I've installed 1.29 from debian backports and was genuinely surprised that it just works (well, except the db was so obsolete that zm couldn't even launch zmupdate.pl, permissions were wrong for API, no tmp folder under app - but compared to earlier days this is nothing).

Anyway, the ONLY thing that still holds me back from just installing zm from the repo - a missing patch fro edimax cameras. I found this patch years ago on some forum, but without this patch my IP cameras do not work. The reason is that cameras return content-boundary in double quotes inside http response. This is allowed by standard, but is an unusual behaviour. If there is any way to integrate this patch into main tree, life would be much easier. Thanks for all the work!

Code: Select all

--- zoneminder-1.29.0+dfsg.orig/src/zm_remote_camera_http.cpp
+++ zoneminder-1.29.0+dfsg/src/zm_remote_camera_http.cpp
@@ -343,7 +343,7 @@ int RemoteCameraHttp::GetResponse()
                         }
 
                         if ( !content_type_expr )
-                            content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=(.+?))?\r?\n", PCRE_CASELESS );
+                            content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=\x22?(.+?)\x22?)?\r?\n", PCRE_CASELESS );
                         if ( content_type_expr->Match( header, header_len ) >= 2 )
                         {
                             content_type = content_type_expr->MatchString( 1 );
@@ -799,8 +799,10 @@ Debug(3, "Need more data buffer %d < con
                                 if ( strncasecmp( start_ptr, boundary_match, boundary_match_len ) == 0 )
                                 {
                                     start_ptr += boundary_match_len;
-                                    start_ptr += strspn( start_ptr, "-" );
+                                    start_ptr += strspn( start_ptr, "-\x22" ); // modified to allow facultative double quote in boundary="myboundary" like on IC-1500 cameras
                                     content_boundary_len = sprintf( content_boundary, "--%s", start_ptr );
+                                    content_boundary_len = strcspn( content_boundary, "\x22" );
+                                    content_boundary[content_boundary_len]='\0';
                                     Debug( 3, "Got content boundary '%s'", content_boundary );
                                 }
                                 else
User avatar
iconnor
Posts: 2900
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Edimax IP cameras

Post by iconnor »

I will see that it gets done.
Post Reply