@@ -644,10 +644,10 @@ void connection<config>::remove_header(std::string const & key)
644
644
* Warning: deferred connections won't time out and as a result can tie up
645
645
* resources.
646
646
*
647
- * @param ec A status code, zero on success, non-zero otherwise
647
+ * @return A status code, zero on success, non-zero otherwise
648
648
*/
649
649
template <typename config>
650
- void connection<config>::defer_http_response(lib::error_code & ec ) {
650
+ lib::error_code connection<config>::defer_http_response() {
651
651
// Cancel handshake timer, otherwise the connection will time out and we'll
652
652
// close the connection before the app has a chance to send a response.
653
653
if (m_handshake_timer) {
@@ -658,10 +658,10 @@ void connection<config>::defer_http_response(lib::error_code & ec) {
658
658
// Do something to signal deferral
659
659
m_http_state = session::http_state::deferred;
660
660
661
- ec = lib::error_code ();
661
+ return lib::error_code ();
662
662
}
663
663
664
- // / Send deferred HTTP Response
664
+ // / Send deferred HTTP Response (exception free)
665
665
/* *
666
666
* Sends an http response to an HTTP connection that was deferred. This will
667
667
* send a complete response including all headers, status line, and body
@@ -687,6 +687,15 @@ void connection<config>::send_http_response(lib::error_code & ec) {
687
687
ec = lib::error_code ();
688
688
}
689
689
690
+ template <typename config>
691
+ void connection<config>::send_http_response() {
692
+ lib::error_code ec;
693
+ this ->send_http_response (ec);
694
+ if (ec) {
695
+ throw exception (ec);
696
+ }
697
+ }
698
+
690
699
691
700
692
701
0 commit comments