HTTP Parse Error on ZWaveAPI

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
beeguy123
Posts: 10
Joined: 20 Feb 2016 13:55

HTTP Parse Error on ZWaveAPI

Post by beeguy123 »

Hi. For my homegrown domotics I need to access ZWaveAPI from node.js on the local Pi.

For example, my domotics server runs :
var request = require('request');
request.get('http://127.0.0.1:8083/ZWaveAPI/Run/devi ... 32].Set(1)', {
'auth': { 'user': 'admin', 'pass': 'xxxxx' }
},function(error,response,body){ console.log(error) }
)

The result is :
{ [Error: Parse Error] bytesParsed: 193, code: 'HPE_UNEXPECTED_CONTENT_LENGTH' } !

This is in Raspian Jessie Lite on Pi Model 2 B. Z-way version 2.2.0. (Have tried older versions, same result.) Tried both node versions 4.3.0 and 5.6.0.

The very same node.js code run from another Pi (only changing the target IP) does work fine ! So I exclude an authentication issue. That other Pi is Model B, runs Wheezy and node 0.12.6 ; those are the only differences between both systems I can think of.
An older setup on the local Pi 2 B using Wheezy and node 0.12.6 did work fine (localhost, no authentication).
Pointing the node sample code to a url on a different http server on localhost also works fine, so no issue with loopback interface. It seems specific to ZWaveAPI.

I can't figure out that error message. Does it point to anything ?
Is there a known issue with ZWaveAPI (perhaps related to localhost /Jessie ?)
graycrow
Posts: 18
Joined: 09 Jan 2013 00:08

Re: HTTP Parse Error on ZWaveAPI

Post by graycrow »

Well, I have the same issue. It's something to do with last Node.js update. I even asked a question on Stackoverflow (http://stackoverflow.com/questions/3552 ... ent-length), maybe someone will help us.
beeguy123
Posts: 10
Joined: 20 Feb 2016 13:55

Re: HTTP Parse Error on ZWaveAPI

Post by beeguy123 »

Thank you graycrow !
If it doesn't get fixed I'll dial it back to node 0.12.10 (lts) then. (Even though pre 4.0.0 is harder to install.)
graycrow
Posts: 18
Joined: 09 Jan 2013 00:08

Re: HTTP Parse Error on ZWaveAPI

Post by graycrow »

Looks like this should be fixed on RaZberry side. According to the commit in the Node.js repository,
Cannot use chunked encoding and a content-length header together per the HTTP specification.
and current Z-way API call looks like this:

Code: Select all

http://127.0.0.1:8083/ZWaveAPI/Run/devices[11].instances[2].commandClasses[49].data[1].val.value
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 5
Content-Type: application/json
Transfer-Encoding: chunked

21.81
As you can see there is both chunked encoding and a content-length headers.
Github issue #323 (added by moderator)
bladerunner2020
Posts: 3
Joined: 27 Mar 2016 13:41

Re: HTTP Parse Error on ZWaveAPI

Post by bladerunner2020 »

I got the same issue. So was forced to downgrade to node v5.2.0.
I am trying to find any workaround this issue, but so far with no luck.

-ap
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: HTTP Parse Error on ZWaveAPI

Post by PoltoS »

Please try this build v2.2.2-test-new-webserver (exists only for Raspberry Pi).

Some functions might not work. Please write here all bugs you see related to the new http server implementation: https://github.com/Z-Wave-Me/z-way-issues/issues/107
diemue
Posts: 34
Joined: 09 Sep 2015 12:40

Re: HTTP Parse Error on ZWaveAPI

Post by diemue »

The camara support in the new web server ist not very good. In a web browser i have a very slow motion. In the iphone app, i have no picture. Tested with FosCam Outdoor Cameras (FI9805W,FI8905W,FI9805E) profile.
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: HTTP Parse Error on ZWaveAPI

Post by PoltoS »

@diemue: Please provide us more info with your configurations and descirption of the problem. We will focus on it. Also please submit this not here but on the github is possible:
https://github.com/Z-Wave-Me/z-way-issues/issues/107
beeguy123
Posts: 10
Joined: 20 Feb 2016 13:55

Re: HTTP Parse Error on ZWaveAPI

Post by beeguy123 »

This fixes the problem I reported above. Tested and works fine with node.js 4.4.4 LTS. Thanks.
Post Reply