Page 1 of 1

HTTP Parse Error on ZWaveAPI

Posted: 20 Feb 2016 14:26
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 ?)

Re: HTTP Parse Error on ZWaveAPI

Posted: 20 Feb 2016 19:54
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.

Re: HTTP Parse Error on ZWaveAPI

Posted: 20 Feb 2016 21:06
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.)

Re: HTTP Parse Error on ZWaveAPI

Posted: 20 Feb 2016 23:59
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)

Re: HTTP Parse Error on ZWaveAPI

Posted: 27 Mar 2016 13:44
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

Re: HTTP Parse Error on ZWaveAPI

Posted: 17 May 2016 12:33
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

Re: HTTP Parse Error on ZWaveAPI

Posted: 19 May 2016 13:37
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.

Re: HTTP Parse Error on ZWaveAPI

Posted: 20 May 2016 15:14
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

Re: HTTP Parse Error on ZWaveAPI

Posted: 21 May 2016 00:03
by beeguy123
This fixes the problem I reported above. Tested and works fine with node.js 4.4.4 LTS. Thanks.