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

ask for help:: How to send the main body content multiple times? #535

Open
gaowanlu opened this issue Nov 8, 2022 · 1 comment
Open

Comments

@gaowanlu
Copy link

gaowanlu commented Nov 8, 2022

For example, if I want to send a file to the client, each time I call the read function, I will read 1024 bytes from the file. How to send it only once without using Bytes, but send it every read. Looking forward to your help.

@gaowanlu
Copy link
Author

gaowanlu commented Nov 8, 2022

    session->yield(OK, "8\r\nrestbed \r\n", {{"Transfer-Encoding", "chunked"}}, [](const shared_ptr<Session> session)
                   { session->yield("10\r\nchunked encoding\r\n", [](const shared_ptr<Session> session)
                                    { session->close("0\r\n\r\n"); }); });

Maybe the size of a file is relatively large. Is it possible that a large number of callbacks may cause the stack to be too large? The correct way should be how to use it!

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

1 participant