Now optionally runs in nph mode.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@951 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
9efff7fdfb
commit
6f02a01f36
21
src/zms.cpp
21
src/zms.cpp
|
@ -21,7 +21,7 @@
|
||||||
#include "zm_db.h"
|
#include "zm_db.h"
|
||||||
#include "zm_monitor.h"
|
#include "zm_monitor.h"
|
||||||
|
|
||||||
int main(void )
|
int main( int argc, const char *argv[] )
|
||||||
{
|
{
|
||||||
enum { ZMS_JPEG, ZMS_MPEG } mode = ZMS_JPEG;
|
enum { ZMS_JPEG, ZMS_MPEG } mode = ZMS_JPEG;
|
||||||
char format[32] = "";
|
char format[32] = "";
|
||||||
|
@ -38,12 +38,21 @@ int main(void )
|
||||||
|
|
||||||
zm_dbg_name = "zms";
|
zm_dbg_name = "zms";
|
||||||
|
|
||||||
|
bool nph = false;
|
||||||
|
const char *basename = strrchr( argv[0], '/' );
|
||||||
|
const char *nph_prefix = "nph-";
|
||||||
|
if ( basename && !strncmp( basename+1, nph_prefix, strlen(nph_prefix) ) )
|
||||||
|
{
|
||||||
|
zm_dbg_name = "nph-zms";
|
||||||
|
nph = true;
|
||||||
|
}
|
||||||
|
|
||||||
zmDbgInit();
|
zmDbgInit();
|
||||||
|
|
||||||
const char *query = getenv( "QUERY_STRING" );
|
const char *query = getenv( "QUERY_STRING" );
|
||||||
if ( query )
|
if ( query )
|
||||||
{
|
{
|
||||||
Info(( "Query: %s", query ));
|
Debug( 1, ( "Query: %s", query ));
|
||||||
|
|
||||||
char temp_query[1024];
|
char temp_query[1024];
|
||||||
strcpy( temp_query, query );
|
strcpy( temp_query, query );
|
||||||
|
@ -90,6 +99,10 @@ int main(void )
|
||||||
zmDbConnect( ZM_DB_USERA, ZM_DB_PASSA );
|
zmDbConnect( ZM_DB_USERA, ZM_DB_PASSA );
|
||||||
|
|
||||||
setbuf( stdout, 0 );
|
setbuf( stdout, 0 );
|
||||||
|
if ( nph )
|
||||||
|
{
|
||||||
|
fprintf( stdout, "HTTP/1.0 200 OK\r\n" );
|
||||||
|
}
|
||||||
fprintf( stdout, "Server: ZoneMinder Video Server/%s\r\n", ZM_VERSION );
|
fprintf( stdout, "Server: ZoneMinder Video Server/%s\r\n", ZM_VERSION );
|
||||||
|
|
||||||
time_t now = time( 0 );
|
time_t now = time( 0 );
|
||||||
|
@ -101,6 +114,10 @@ int main(void )
|
||||||
fprintf( stdout, "Cache-Control: no-store, no-cache, must-revalidate\r\n" );
|
fprintf( stdout, "Cache-Control: no-store, no-cache, must-revalidate\r\n" );
|
||||||
fprintf( stdout, "Cache-Control: post-check=0, pre-check=0\r\n" );
|
fprintf( stdout, "Cache-Control: post-check=0, pre-check=0\r\n" );
|
||||||
fprintf( stdout, "Pragma: no-cache\r\n");
|
fprintf( stdout, "Pragma: no-cache\r\n");
|
||||||
|
if ( !nph )
|
||||||
|
{
|
||||||
|
fprintf( stdout, "Content-Length: 0\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
if ( !event )
|
if ( !event )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue