]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/HttpControlMsg.h
1 #ifndef SQUID_HTTP_CONTROL_MSG_H
2 #define SQUID_HTTP_CONTROL_MSG_H
5 #include "base/AsyncCall.h"
10 * This API exists to throttle forwarding of 1xx messages from the server
11 * side (Source == HttpStateData) to the client side (Sink == ConnStateData).
13 * Without throttling, Squid would have to drop some 1xx responses to
14 * avoid DoS attacks that send many 1xx responses without reading them.
15 * Dropping 1xx responses without violating HTTP is as complex as throttling.
18 /// sends a single control message, notifying the Sink
19 class HttpControlMsgSink
: public virtual AsyncJob
22 HttpControlMsgSink(): AsyncJob("unused") {}
24 /// called to send the 1xx message and notify the Source
25 virtual void sendControlMsg(HttpControlMsg msg
) = 0;
28 /// bundles HTTP 1xx reply and the "successfully forwarded" callback
32 typedef HttpMsgPointerT
<HttpReply
> MsgPtr
;
33 typedef AsyncCall::Pointer Callback
;
35 HttpControlMsg(const MsgPtr
&aReply
, const Callback
&aCallback
):
36 reply(aReply
), cbSuccess(aCallback
) {}
39 MsgPtr reply
; ///< the 1xx message being forwarded
40 Callback cbSuccess
; ///< called after successfully writing the 1xx message
42 // We could add an API to notify of send failures as well, but the
43 // current Source and Sink are tied via Store anyway, so the Source
44 // will know, eventually, if the Sink is gone or otherwise failed.
48 operator <<(std::ostream
&os
, const HttpControlMsg
&msg
)
50 return os
<< msg
.reply
<< ", " << msg
.cbSuccess
;
53 #endif /* SQUID_HTTP_CONTROL_MSG_H */