]>
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
4 #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 AsyncCall::Pointer Callback
;
34 HttpControlMsg(const HttpReply::Pointer
&aReply
, const Callback
&aCallback
):
35 reply(aReply
), cbSuccess(aCallback
) {}
38 HttpReply::Pointer reply
; ///< the 1xx message being forwarded
39 Callback cbSuccess
; ///< called after successfully writing the 1xx message
41 // We could add an API to notify of send failures as well, but the
42 // current Source and Sink are tied via Store anyway, so the Source
43 // will know, eventually, if the Sink is gone or otherwise failed.
47 operator <<(std::ostream
&os
, const HttpControlMsg
&msg
)
49 return os
<< msg
.reply
<< ", " << msg
.cbSuccess
;
52 #endif /* SQUID_HTTP_CONTROL_MSG_H */