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

No support for interim responses (Info) #1762

Open
blazarr opened this issue Jan 25, 2024 · 7 comments
Open

No support for interim responses (Info) #1762

blazarr opened this issue Jan 25, 2024 · 7 comments

Comments

@blazarr
Copy link

blazarr commented Jan 25, 2024

It does not appear that the server provides a way to send interim http response statuses.

I see there is handling for 100 Continue, but there should be a way from the request handlers to send an interim response.

Am I just missing something? Is there a workaround with res.set_content_provider?

@yhirose
Copy link
Owner

yhirose commented Jan 25, 2024

You can use the following method.

Server &set_expect_100_continue_handler(Expect100ContinueHandler handler);

@yhirose yhirose closed this as completed Jan 25, 2024
@blazarr
Copy link
Author

blazarr commented Jan 25, 2024

I am confused, that handler only gets called if the client sends the Expect: 100 Continue header.

From what I can tell, it is within spec for servers to send interim responses regardless of an Expect header being sent from a client.

Perhaps you don’t feel it’s important to implement, which I understand, would like to at least hear your thoughts on it.

@yhirose
Copy link
Owner

yhirose commented Jan 26, 2024

@blazarr sorry, but I am not really sure if I understand what you are asking for. Could you explain more clearly what you are trying to do?

@blazarr
Copy link
Author

blazarr commented Jan 27, 2024 via email

@yhirose
Copy link
Owner

yhirose commented Jan 27, 2024

I now understand your request. To be honest, I was just concerned with Expect: 100 Continue header on both server and client sides. (On server side, a user can control response behavior with the Expect100ContinueHandler. But on client side, it just skips all the 100 Continue responses.) If you are only interested in sending 100 Continue, you don't have to do anything.

If you are interested in 101 or 103, cpp-httplib doesn't support it at this point. I might be able to do something for those messages, but I don't have specific use cases in my projects. I feel each informational response has a different requirement. For instance, the way to handle 101 Switching Protocols should be very different from 103 Early Hints. Could you tell me what you exactly want to do?

@yhirose yhirose reopened this Jan 27, 2024
@blazarr
Copy link
Author

blazarr commented Jan 28, 2024

Yep, I would love to be able to implement this draft spec.

https://datatracker.ietf.org/doc/draft-ietf-httpbis-resumable-upload/

The spec specifically calls out how many http client and server libraries don’t have the proper support for informational responses.

I just figured, since the server already had support for sending these, and they are pretty straight forward it wouldn’t be a huge ask.

@yhirose
Copy link
Owner

yhirose commented Jan 28, 2024

#1103 may be related.

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

No branches or pull requests

2 participants