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

Sending multiple responses to a single request #1110

Open
sorinluc opened this issue Jan 4, 2023 · 0 comments
Open

Sending multiple responses to a single request #1110

sorinluc opened this issue Jan 4, 2023 · 0 comments

Comments

@sorinluc
Copy link

sorinluc commented Jan 4, 2023

Hello !

This question might be as related to HTTP as it is to Pistache itself but here we are :
Some operations performed by our server (built with Pistache ❤️) are long (several minutes before completion), so they trigger a client-side timeout.

I came across the 102 PROCESSING status code, that might be used to indicate "wait a bit more", but I am not sure it can be used with Pistache as following:

void onRequest(const Http::Request& request, Http::ResponseWriter response) {
    sleep(2);  // simulate long task
    response.send(Http::Code::Processing);
    sleep(2);  // a bit more of that long task
    response.send(Http::Code::Ok);
}

This produces the following TCP trace:
image

2 remarks:

  • Both responses are sent together after 4 seconds (I would have expected one after 2 sec and another at 4 sec)
  • The second response sort of "contains both the codes, concatenated", and is not interpreted correctly by the HTTP client I'm using

I, honestly, cannot point at the culprit :

  • Is it expected behaviour, and the client just does not support that use case ?
  • Is it a Pistache issue ?
  • Is it just my poor understanding of HTTP ?

Thanks for the hard work on the library by the way !

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