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

Receive only a certain amount of bytes in StreamBody #109

Open
lordi opened this issue Feb 26, 2019 · 2 comments
Open

Receive only a certain amount of bytes in StreamBody #109

lordi opened this issue Feb 26, 2019 · 2 comments

Comments

@lordi
Copy link

lordi commented Feb 26, 2019

Is it possible to not use the stream body as an iterator, but to read from it like from a file? I'd like to do read(2048) for example to read the next 2048 bytes.

I skipped around the source a little bit, and it looks like _recv_event is the function that does it, but it has 10000 as a hardcoded read limit.

What do you think about adding to a public function read function to StreamBody?

@theelous3
Copy link
Owner

theelous3 commented Feb 26, 2019 via email

@theelous3
Copy link
Owner

theelous3 commented Mar 13, 2019

So, my only issue with this is that decompression and encoding goes out the window as soon as we set our own limits, rather than let h11 handle it.

In the meantime I've added an attr, StreamBody.read_size so at least that can be controlled. Need to think about how to nicely handle arbitrary reads.

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

2 participants