Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest API V2 Transfer-encoding: chunked #6

Open
HeikoG67 opened this issue Oct 19, 2023 · 4 comments
Open

Rest API V2 Transfer-encoding: chunked #6

HeikoG67 opened this issue Oct 19, 2023 · 4 comments

Comments

@HeikoG67
Copy link

The current API response delivers result as Transfer-encoding: chunked.
It is no problem using Pyhton V3.x request but in case using e.g. micropython version of request, it cannot handle chunked requests.
So it is difficult to use a simple microcontroller based control setup.
I am currently using a PI pico to continously get PV data from a Fenecon inverter and send it to my go-e charger to allow pv surplus charging. I found a way to get it working without request but it could be much simpler without Transfer-encoding: chunked.

@0xFEEDC0DE64
Copy link
Contributor

The ESP32 in the charger doesnt have enough heap space free to store the full http response in memory, therefore I implemented a 4kb chunked buffering while returning the response, there are no ways to change that!

could you setup your raspberry pi as a simple reverse proxy to the charger maybe?

@mincequi
Copy link

Hi @0xFEEDC0DE64 ,
indeed, these chunked transfers are troublesome for microcontrollers (and other incomplete http clients).
I was also wondering, why the chunked header is default. Even for smaller messages than 4kb.
Since i also get a chunked header for this filter: /api/status?filter=nrg,car

Is there anything you can do about this? My shelly devices do not send chunked data.

Thanks a lot!

Cheers.

@peterpoetzi
Copy link
Member

peterpoetzi commented Mar 22, 2024

Maybe we can introduce a GET parameter &nochunk that will disable this behavior and either give you the full response if it is below 4kB or an HTTP error response otherwise

@mincequi
Copy link

Yes, that sounds good. Or you just remove the chunked header when message buffer is below 4kB?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants