This should make it more difficult to accidentally forget to send a
response and cause a hang.
Currently this assert-crashes, although it would have been possible to make
it return some internal error instead also.
http_server_request_fail(req, 505, "Not Implemented");
return;
} else {
+ unsigned int old_refcount = req->refcount;
+
conn->callbacks->handle_request(conn->context, req);
+ i_assert((req->response != NULL &&
+ req->response->submitted) ||
+ req->refcount > old_refcount);
}
}
}
};
struct http_server_callbacks {
+ /* Reference the server request. Before returning you must either send
+ a response to the request or reference the request with
+ http_server_request_ref() and unreference it later after sending
+ the response. */
void (*handle_request)(void *context, struct http_server_request *req);
void (*handle_connect_request)(void *context,
struct http_server_request *req, struct http_url *target);