Page 1 of 1

I think this is a BUG, missine \r's

Posted: Tue Aug 29, 2006 5:38 pm
by mycal
I was trying to get a chineese video server to work with zoneminder and was having problems with password authentication, it worked with the browser but not with zoneminder, so I looked at the packet traces and found that the HTTP GET is missing '\r' at the end of each line in the HTTP header. I added these and the video server started working.

It might be a good idea to add these, as the embedded ecos webserver doesn't like it when they are not there. And all regular browswers inculde them and the RFC requires them:
HTTP/1.0 defines the octet sequence CR LF as the end-of-line marker for all protocol elements except the Entity-Body (see Appendix B for tolerant applications). The end-of-line marker within an Entity-Body is defined by its associated media type, as described in Section 3.6.

CRLF = CR LF
In zm_remote_camera.cpp:

Code: Select all

   if ( !request[0] )
    {
        snprintf( request, sizeof(request), "GET %s HTTP/%s\r\n", path, (const char *)config.Item( ZM_HTTP_VERSION ) );
        snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "User-Agent: %s/%s\r\n", (const char *)config.Item( ZM_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" );
        if ( auth )
        {
            snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "Authorization: Basic %s\r\n", auth64 );
        }
        snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "\r\n" );
        Debug( 2, ( "Request: %s", request ));
    }
mycal

[/quote]

Posted: Wed Aug 30, 2006 1:18 pm
by zoneminder
Thanks for this. I will take a look and apply any corrections.