Page 1 of 1

Remote camera and HTTP 1.1 vs. HTTP 1.0

Posted: Sun Jan 02, 2005 8:22 am
by brucehvn
I have one network IP camera that needs to be interfaced through a separate cgi script. The cgi script simply grabs an image from the camera and outputs it with a Content-type: image/jpeg header. My system is a Debian system running Apache 1.3.33.

When I had ZoneMinder configured for Http 1.1, the program couldn't seem to get an image from the camera and timed out every time. In looking at the debug output, it appears that ZM couldn't figure out when it had received the last batch of data from the web server and would just sit there until the timeout was reached. When I changed ZM to use Http 1.0, then it would detect that it had gotten all the data because the server closed the connection. I'm not sure if there is a problem with the way the cgi script is handling the output, or something else. It's working as long as I use the http 1.0, but here's the pertinent entries from the syslog.

Code: Select all

Using HTTP 1.1
--------------
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB2 [Request: GET /ipcam/cgi-bin/webveo.cgi?action=getimage HTTP/1.1 User-Agent: ZoneMinder/1.19.5 Host: homeauto Connection: Keep-Alive Authorization: Basic xxxxxxxxxxxxx ]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [monitor purpose=1]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [shm.size=3456108]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [Initialised zone 0/All - 1 - 320x240 - Rgb:ff0000, CM:3, MnAT:15, MxAT:0, MnAP:50, MxAP:75000, FB:3x3, MnFP:50, MxFP:50000, MnBS:10, MxBS:0, MnB:0, MxB:0]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [Monitor Veo has function 3]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [Monitor Veo LBF = '%%s - %y/%m/%d %H:%M:%S', LBX = 0, LBY = 0]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [Monitor Veo IBC = 15, WUC = 4, pEC = 3, PEC = 3, EAF = 2, FRI = 1000, RBP = 10]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [Got 1 zones for monitor Veo]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [Initialised zone 3/All - 1 - 320x240 - Rgb:ff0000, CM:3, MnAT:25, MxAT:0, MnAP:2304, MxAP:57600, FB:3x3, MnFP:2304, MxFP:57600, MnBS:1536, MxBS:0, MnB:1, MxB:0]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB1 [Loaded monitor 3(Veo), 1 zones]
Jan  1 23:50:09 homeauto zmc_m3[3288]: INF [Starting Capture]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB3 [Connected to host, socket = 5]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB3 [Request sent]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB3 [Expecting 4329 bytes]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB3 [Read 4329 bytes]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB4 [Captured header (252 bytes): 'HTTP/1.1 200 OK
Date: Sun, 02 Jan 2005 07:50:09 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-2 mod_ssl/2.8.22 OpenSSL/0.9.7d
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: image/jpeg']
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB3 [Got status '200' (OK), http version 1.1]
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB3 [Got connection 'Keep-Alive']
Jan  1 23:50:09 homeauto zmc_m3[3288]: DB3 [Got content type 'image/jpeg' ]
Jan  1 23:50:10 homeauto zmc_m3[3288]: DB3 [Expecting 1244 bytes]
Jan  1 23:50:10 homeauto zmc_m3[3288]: DB3 [Read 1244 bytes]
Jan  1 23:50:13 homeauto zmc_m3[3288]: ERR [Select timed out]

Code: Select all

Using HTTP 1.0
--------------
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB2 [Request: GET /ipcam/cgi-bin/webveo.cgi?action=getimage HTTP/1.0 User-Agent: ZoneMinder/1.19.5 Host: homeauto Connection: Keep-Alive Authorization: Basic xxxxxxxxxxxxx ]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [monitor purpose=1]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [shm.size=3456108]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [Initialised zone 0/All - 1 - 320x240 - Rgb:ff0000, CM:3, MnAT:15, MxAT:0, MnAP:50, MxAP:75000, FB:3x3, MnFP:50, MxFP:50000, MnBS:10, MxBS:0, MnB:0, MxB:0]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [Monitor Veo has function 3]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [Monitor Veo LBF = '%%s - %y/%m/%d %H:%M:%S', LBX = 0, LBY = 0]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [Monitor Veo IBC = 15, WUC = 4, pEC = 3, PEC = 3, EAF = 2, FRI = 1000, RBP = 10]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [Got 1 zones for monitor Veo]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [Initialised zone 3/All - 1 - 320x240 - Rgb:ff0000, CM:3, MnAT:25, MxAT:0, MnAP:2304, MxAP:57600, FB:3x3, MnFP:2304, MxFP:57600, MnBS:1536, MxBS:0, MnB:1, MxB:0]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB1 [Loaded monitor 3(Veo), 1 zones]
Jan  1 23:55:53 homeauto zmc_m3[3354]: INF [Starting Capture]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Connected to host, socket = 5]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Request sent]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Expecting 4256 bytes]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Read 4256 bytes]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB4 [Captured header (186 bytes): 'HTTP/1.1 200 OK
Date: Sun, 02 Jan 2005 07:55:53 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-2 mod_ssl/2.8.22 OpenSSL/0.9.7d
Connection: close
Content-Type: image/jpeg']
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Got status '200' (OK), http version 1.1]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Got connection 'close']
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Got content type 'image/jpeg' ]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Expecting 1326 bytes]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Read 1326 bytes]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Expecting 0 bytes]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Socket closed]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Got end of image by closure, content-length = 5396]
Jan  1 23:55:53 homeauto zmc_m3[3354]: DB3 [Returning 5396 (5396) bytes of captured content]

Posted: Sun Jan 02, 2005 8:32 am
by brucehvn
Okay, I can answer my own question. The cgi script was not sending a content-length header. That fixed the problem.

Bruce

Posted: Tue Jan 04, 2005 11:29 am
by zoneminder
Hi Bruce,

Thanks for the information. ZM should still have been able to handle things in HTTP 1.1 so I'll take a look at that.

I notice you are using a Veo camera. Can you tell me which model? I had a Veo Observer, cheap wireless PTZ, for a while but it did not support http as an access method. I read that a newer version was being released which did but haven't had chance to try one yet.

Cheers,

Phil

Posted: Tue Jan 04, 2005 11:48 am
by brucehvn
Hi Phil,

I have one of the original Veo Observer wired cameras. As you said, it only supported access via Internet Explorer because they use Active X controls exclusively. I found a website where a guy had figured out the communications and wrote a perl module that can access the camera. There's another person who wrote a Java program that can access the observer. The script I'm iusing with ZM is one that was an example on how to use the Perl module via cgi. It essentially lets you grab one image from the camera or control the pan/tilt. The Perl module (and Java app) are capable of streaming also, so it's great for me. When I switched my server to Linux, I thought that camera would be of no use to me anymore as a surveillance camera.

Bruce

Posted: Wed Feb 23, 2005 10:02 am
by hfwang
Bruce,

I installed the same cgi script but I am trying to figure out how to use it.
- Installed veo.pm -> working
- Installed webveo.cgi -> works with browser

- Remote host: user:pass@192.168.0.1
- Port: 80
- Remote host path: /cgi-bin/webveo.cgi?action=getimage
- COntinious stream

Also in the ps list I see webveo.cgi <defunct>

But I get no picture or stream.

Any ideas, hints or tips?

ps. Status of the monitor is orange (monitor)

Posted: Wed Feb 23, 2005 11:09 am
by hfwang
Sorry for the noise, http 1.0 works (I should read the thread better ;-) )

Posted: Sat Mar 26, 2005 5:19 am
by cordel
Bump to the harware compat. list ?
Also here is a link to the scripts.
http://www.kahunaburger.com/blog/archives/000157.html

Regards,
Cordel

Posted: Thu Apr 13, 2006 8:53 pm
by sogood007
http 1.0 works but not 1.1. Is there any reason? Is there any drawback of using 1.0

-Calvin

Posted: Mon Apr 17, 2006 8:33 pm
by zoneminder
No there is no drawback. The differences are fairly minor and mostly to do with keeping connections open and the format of headers etc.

Posted: Wed Apr 19, 2006 5:36 am
by sogood007
After I modify the webveo.cgi to exit with 0 instead of 1. Then I can use HTTP 1.1. Is that making any sense?

Posted: Wed Apr 19, 2006 8:50 am
by zoneminder
I don't know. Possibly the web server uses the return code to determine whether to keep the connection open or close it, or for some other purpose.