http.request appears to lack ability to deal with chunking

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
jet11x
Posts: 53
Joined: 29 Dec 2014 21:15

http.request appears to lack ability to deal with chunking

Post by jet11x »

I'm trying to use http.request to get status information from an alarm system.
After some fiddling I managed to get the first part of the response, but not the details I required.
Doing the same query from a small node.js application I believe the problem is that the data is coming back in chunks and I'm only getting the first one back using http.request

I using the asynch mode in the hope it would do repeated calls to responses, but both method success and complete only get called once.

At this stage only way to solve this that I can see is to setup an intermediate web-server that extracts the information required and makes available for http.request in z-wave.me module or another web server that get data from alarm and then call in to the JS functions of z-wave.me. Both call for complexity of another web server which isn't ideal.
I'm also going to see if I can use the socket API to do my own http client implementation.

I can't find the source for http.request anywhere to investigate - I assume this is part of the C implementation which isn't made public.

Appreciate any workarounds or fixes you can suggest.
jet11x
Posts: 53
Joined: 29 Dec 2014 21:15

Re: http.request appears to lack ability to deal with chunking

Post by jet11x »

Any thoughts on this?
I'm now part way into writing code for an intermediate web server.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: http.request appears to lack ability to deal with chunking

Post by PoltoS »

Do you have an example of such server? Some public request.

In v.2.3.6 we have added the ability to decode the answer (added CURLOPT_HTTP_CONTENT_DECODING). If this do not help to decode chunked, we can fix that.
jet11x
Posts: 53
Joined: 29 Dec 2014 21:15

Re: http.request appears to lack ability to deal with chunking

Post by jet11x »

I don't have a public example. But here's some more information:
- Wikipedia article on chunking in http 1.1. https://en.wikipedia.org/wiki/Chunked_transfer_encoding
- Example using node js and http.request with chunking, search for chunk on https://nodejs.org/en/docs/guides/anato ... ansaction/

I'll see about moving on to 2.3.6 in the not to distant future. Is there more information on CURLOPT_HTTP_CONTENT_DECODING?
jet11x
Posts: 53
Joined: 29 Dec 2014 21:15

Re: http.request appears to lack ability to deal with chunking

Post by jet11x »

Upgrading to 2.3.6 did the trick. Thanks for the advice.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: http.request appears to lack ability to deal with chunking

Post by PoltoS »

Nice to know. Thanks for the confirmation
Post Reply