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

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
mycal
Posts: 65
Joined: Tue Nov 09, 2004 6:39 am

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

Post 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]
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for this. I will take a look and apply any corrections.
Phil
Post Reply