libnhttp/nhttp/server/http_context.hpp
/* close context and send response. */
close context and send response.
close context and send response .
inline bool close(bool keepalive = true) {
			NHTTP_ENSURE(
				!_is_closed,
				"this stream is already closed."
			);
			if (!_is_closed) {
				NHTTP_INIT_ASSERT(
					request, 
					"request object is overwritten at somewhere!"
				);
				_is_closed = true;
				if (!response) {
					response = make_response(200);
				}
				if (request->hooks.size()) {
					for (auto each : request->hooks) {
						each->on_response(*request.get(), *response.get());
					}
				}
				raw->response.status = std::move(response->status);
				raw->response.headers = std::move(response->headers);
				raw->response.content = response->content;
				return raw->close(keepalive);
			}
			return false;
		}
inline bool close ( bool keepalive = true ) { NHTTP_ENSURE ( ! _is_closed , " " ) ; if ( ! _is_closed ) { NHTTP_INIT_ASSERT ( request , " " ) ; _is_closed = true ; if ( ! response ) { response = make_response ( 200 ) ; } if ( request -> hooks . size ( ) ) { for ( auto each : request -> hooks ) { each -> on_response ( * request . get ( ) , * response . get ( ) ) ; } } raw -> response . status = std :: move ( response -> status ) ; raw -> response . headers = std :: move ( response -> headers ) ; raw -> response . content = response -> content ; return raw -> close ( keepalive ) ; } return false ; }
close context and send response.
close context and send response .
/* move assignment. */ /* then close context. */