Remote camera and HTTP 1.1 vs. HTTP 1.0

Support and queries relating to all previous versions of ZoneMinder
Locked
brucehvn
Posts: 6
Joined: Sun Jan 02, 2005 6:23 am

Remote camera and HTTP 1.1 vs. HTTP 1.0

Post 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]
brucehvn
Posts: 6
Joined: Sun Jan 02, 2005 6:23 am

Post by brucehvn »

Okay, I can answer my own question. The cgi script was not sending a content-length header. That fixed the problem.

Bruce
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post 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
brucehvn
Posts: 6
Joined: Sun Jan 02, 2005 6:23 am

Post 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
hfwang
Posts: 6
Joined: Wed Feb 23, 2005 9:10 am

Post 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)
hfwang
Posts: 6
Joined: Wed Feb 23, 2005 9:10 am

Post by hfwang »

Sorry for the noise, http 1.0 works (I should read the thread better ;-) )
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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
Image
Image
3939663646337

It's better to keep your mouth shut and appear stupid than open it and remove all doubt.
-Mark Twain
sogood007
Posts: 25
Joined: Tue Oct 26, 2004 6:53 pm

Post by sogood007 »

http 1.0 works but not 1.1. Is there any reason? Is there any drawback of using 1.0

-Calvin
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post 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.
Phil
sogood007
Posts: 25
Joined: Tue Oct 26, 2004 6:53 pm

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

Post 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.
Phil
Locked