Trivial HTTP compliance fix

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
haimg
Posts: 1
Joined: Sun May 13, 2007 5:42 pm

Trivial HTTP compliance fix

Post by haimg »

Hello,
In zm_remote_camera.cpp (Version 1.22.3) ZoneMinder sends not 100% properly formatted HTTP requests (Line feed (\r) is missing), which is required, see http://www.faqs.org/rfcs/rfc1945.html section 6.1. This breaks at remote camera support here (server expects this LF). This trivial patch just adds the needed character:

Code: Select all

--- zm_remote_camera.cpp.orig   2007-05-13 10:46:52.000000000 -0700
+++ zm_remote_camera.cpp        2007-05-13 10:32:28.000000000 -0700
@@ -112,7 +112,7 @@
 
        if ( !request[0] )
        {
-               snprintf( request, sizeof(request), "GET %s HTTP/%s\n", path, config.http_version );
+               snprintf( request, sizeof(request), "GET %s HTTP/%s\r\n", path, config.http_version );
                snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "User-Agent: %s/%s\r\n", config.http_ua, ZM_VERSION );
                snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "Host: %s\r\n", host );
                snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "Connection: Keep-Alive\r\n" );
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for pointing that out. I have made the change in the source.
Phil
Post Reply