cpp-httplib
                                
                                 cpp-httplib copied to clipboard
                                
                                    cpp-httplib copied to clipboard
                            
                            
                            
                        No support for interim responses (Info)
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?
You can use the following method. https://github.com/yhirose/cpp-httplib/blob/449801990fd6629ba2a51f7a82383306d707d53e/httplib.h#L875
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.
@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?
I want to be able to respond to a request with an interim response. A POST request comes in, I want to send back a custom 1xx status code, then after processing I would send the final status code.
On Fri, Jan 26, 2024 at 4:35 PM, yhirose @.***(mailto:On Fri, Jan 26, 2024 at 4:35 PM, yhirose < wrote:
@.***(https://github.com/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?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
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?
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.
#1103 may be related.