Browse Source

[multiple] rename connection_reset hook to request

rename connection_reset to handle_request_reset
master
Glenn Strauss 1 year ago
parent
commit
33c8cf41db
  1. 4
      src/connections.c
  2. 2
      src/gw_backend.c
  3. 2
      src/gw_backend.h
  4. 4
      src/http-header-glue.c
  5. 2
      src/mod_authn_gssapi.c
  6. 4
      src/mod_cgi.c
  7. 2
      src/mod_deflate.c
  8. 2
      src/mod_extforward.c
  9. 2
      src/mod_fastcgi.c
  10. 2
      src/mod_gnutls.c
  11. 2
      src/mod_mbedtls.c
  12. 4
      src/mod_mysql_vhost.c
  13. 2
      src/mod_nss.c
  14. 2
      src/mod_openssl.c
  15. 2
      src/mod_proxy.c
  16. 2
      src/mod_rewrite.c
  17. 2
      src/mod_scgi.c
  18. 6
      src/mod_setenv.c
  19. 2
      src/mod_sockproxy.c
  20. 4
      src/mod_ssi.c
  21. 2
      src/mod_uploadprogress.c
  22. 4
      src/mod_vhostdb.c
  23. 2
      src/mod_webdav.c
  24. 6
      src/mod_wstunnel.c
  25. 6
      src/plugin.c
  26. 4
      src/plugin.h

4
src/connections.c

@ -659,7 +659,7 @@ void connections_free(server *srv) {
static void
request_reset (request_st * const r) {
plugins_call_connection_reset(r);
plugins_call_handle_request_reset(r);
connection_response_reset(r);
@ -1235,7 +1235,7 @@ static int connection_handle_request(request_st * const r) {
http_header_env_set(r, CONST_STR_LEN("REDIRECT_STATUS"), CONST_BUF_LEN(tb));
if (error_handler == r->conf.error_handler) {
plugins_call_connection_reset(r);
plugins_call_handle_request_reset(r);
if (r->reqbody_length) {
if (r->reqbody_length != r->reqbody_queue->bytes_in) {

2
src/gw_backend.c

@ -1797,7 +1797,7 @@ static handler_t gw_reconnect(gw_handler_ctx * const hctx, request_st * const r)
}
handler_t gw_connection_reset(request_st * const r, void *p_d) {
handler_t gw_handle_request_reset(request_st * const r, void *p_d) {
gw_plugin_data *p = p_d;
gw_handler_ctx *hctx = r->plugin_ctx[p->id];
if (hctx) gw_connection_close(hctx, r);

2
src/gw_backend.h

@ -348,7 +348,7 @@ __attribute_cold__
int gw_get_defaults_balance(server *srv, const buffer *b);
handler_t gw_check_extension(request_st *r, gw_plugin_data *p, int uri_path_handler, size_t hctx_sz);
handler_t gw_connection_reset(request_st *r, void *p_d);
handler_t gw_handle_request_reset(request_st *r, void *p_d);
handler_t gw_handle_subrequest(request_st *r, void *p_d);
handler_t gw_handle_trigger(server *srv, void *p_d);
handler_t gw_handle_waitpid_cb(server *srv, void *p_d, pid_t pid, int status);

4
src/http-header-glue.c

@ -820,7 +820,7 @@ void http_response_backend_error (request_st * const r) {
void http_response_backend_done (request_st * const r) {
/* (not CON_STATE_ERROR and not CON_STATE_RESPONSE_END,
* i.e. not called from handle_connection_close or connection_reset
* i.e. not called from handle_connection_close or handle_request_reset
* hooks, except maybe from errdoc handler, which later resets state)*/
switch (r->state) {
case CON_STATE_HANDLE_REQUEST:
@ -920,7 +920,7 @@ static handler_t http_response_process_local_redir(request_st * const r, size_t
/*(caller must reset request as follows)*/
/*connection_response_reset(r);*/ /*(sets r->http_status = 0)*/
/*plugins_call_connection_reset(r);*/
/*plugins_call_handle_request_reset(r);*/
return HANDLER_COMEBACK;
}

2
src/mod_authn_gssapi.c

@ -785,7 +785,7 @@ int mod_authn_gssapi_plugin_init(plugin *p) {
p->name = "authn_gssapi";
p->init = mod_authn_gssapi_init;
p->set_defaults= mod_authn_gssapi_set_defaults;
p->connection_reset = mod_authn_gssapi_handle_reset;
p->handle_request_reset = mod_authn_gssapi_handle_reset;
return 0;
}

4
src/mod_cgi.c

@ -927,7 +927,7 @@ static handler_t mod_cgi_local_redir(request_st * const r) {
/* must be called from mod_cgi_handle_subrequest() so that HANDLER_COMEBACK
* return value propagates back through connection_state_machine() */
connection_response_reset(r); /*(includes r->http_status = 0)*/
plugins_call_connection_reset(r);
plugins_call_handle_request_reset(r);
/*cgi_connection_close(hctx);*//*(already cleaned up and hctx is now invalid)*/
return HANDLER_COMEBACK;
}
@ -1045,7 +1045,7 @@ int mod_cgi_plugin_init(plugin *p) {
p->version = LIGHTTPD_VERSION_ID;
p->name = "cgi";
p->connection_reset = cgi_connection_close_callback;
p->handle_request_reset = cgi_connection_close_callback;
p->handle_subrequest_start = cgi_is_handled;
p->handle_subrequest = mod_cgi_handle_subrequest;
p->handle_waitpid = cgi_waitpid_cb;

2
src/mod_deflate.c

@ -1630,7 +1630,7 @@ int mod_deflate_plugin_init(plugin *p) {
p->init = mod_deflate_init;
p->cleanup = mod_deflate_free;
p->set_defaults = mod_deflate_set_defaults;
p->connection_reset = mod_deflate_cleanup;
p->handle_request_reset = mod_deflate_cleanup;
p->handle_response_start = mod_deflate_handle_response_start;
return 0;

2
src/mod_extforward.c

@ -1219,7 +1219,7 @@ int mod_extforward_plugin_init(plugin *p) {
p->handle_uri_raw = mod_extforward_uri_handler;
p->handle_request_env = mod_extforward_handle_request_env;
p->handle_request_done = mod_extforward_restore;
p->connection_reset = mod_extforward_restore;
p->handle_request_reset = mod_extforward_restore;
p->handle_connection_close = mod_extforward_handle_con_close;
p->set_defaults = mod_extforward_set_defaults;
p->cleanup = mod_extforward_free;

2
src/mod_fastcgi.c

@ -542,7 +542,7 @@ int mod_fastcgi_plugin_init(plugin *p) {
p->init = gw_init;
p->cleanup = gw_free;
p->set_defaults = mod_fastcgi_set_defaults;
p->connection_reset = gw_connection_reset;
p->handle_request_reset = gw_handle_request_reset;
p->handle_uri_clean = fcgi_check_extension_1;
p->handle_subrequest_start = fcgi_check_extension_2;
p->handle_subrequest = gw_handle_subrequest;

2
src/mod_gnutls.c

@ -2946,7 +2946,7 @@ int mod_gnutls_plugin_init (plugin *p)
p->handle_connection_close = mod_gnutls_handle_con_close;
p->handle_uri_raw = mod_gnutls_handle_uri_raw;
p->handle_request_env = mod_gnutls_handle_request_env;
p->connection_reset = mod_gnutls_handle_request_reset;
p->handle_request_reset = mod_gnutls_handle_request_reset;
p->handle_trigger = mod_gnutls_handle_trigger;
return 0;

2
src/mod_mbedtls.c

@ -2445,7 +2445,7 @@ int mod_mbedtls_plugin_init (plugin *p)
p->handle_connection_close = mod_mbedtls_handle_con_close;
p->handle_uri_raw = mod_mbedtls_handle_uri_raw;
p->handle_request_env = mod_mbedtls_handle_request_env;
p->connection_reset = mod_mbedtls_handle_request_reset;
p->handle_request_reset = mod_mbedtls_handle_request_reset;
p->handle_trigger = mod_mbedtls_handle_trigger;
return 0;

4
src/mod_mysql_vhost.c

@ -78,7 +78,7 @@ static void* mod_mysql_vhost_connection_data(request_st * const r, void *p_d)
return r->plugin_ctx[p->id] = c;
}
REQUEST_FUNC(mod_mysql_vhost_handle_connection_reset) {
REQUEST_FUNC(mod_mysql_vhost_handle_request_reset) {
plugin_data *p = p_d;
plugin_connection_data *c = r->plugin_ctx[p->id];
@ -374,7 +374,7 @@ int mod_mysql_vhost_plugin_init(plugin *p) {
p->init = mod_mysql_vhost_init;
p->cleanup = mod_mysql_vhost_cleanup;
p->connection_reset = mod_mysql_vhost_handle_connection_reset;
p->handle_request_reset = mod_mysql_vhost_handle_request_reset;
p->set_defaults = mod_mysql_vhost_set_defaults;
p->handle_docroot = mod_mysql_vhost_handle_docroot;

2
src/mod_nss.c

@ -2707,7 +2707,7 @@ int mod_nss_plugin_init (plugin *p)
p->handle_connection_close = mod_nss_handle_con_close;
p->handle_uri_raw = mod_nss_handle_uri_raw;
p->handle_request_env = mod_nss_handle_request_env;
p->connection_reset = mod_nss_handle_request_reset;
p->handle_request_reset = mod_nss_handle_request_reset;
p->handle_trigger = mod_nss_handle_trigger;
return 0;

2
src/mod_openssl.c

@ -4294,7 +4294,7 @@ int mod_openssl_plugin_init (plugin *p)
p->handle_connection_close = mod_openssl_handle_con_close;
p->handle_uri_raw = mod_openssl_handle_uri_raw;
p->handle_request_env = mod_openssl_handle_request_env;
p->connection_reset = mod_openssl_handle_request_reset;
p->handle_request_reset = mod_openssl_handle_request_reset;
p->handle_trigger = mod_openssl_handle_trigger;
return 0;

2
src/mod_proxy.c

@ -1123,7 +1123,7 @@ int mod_proxy_plugin_init(plugin *p) {
p->init = mod_proxy_init;
p->cleanup = mod_proxy_free;
p->set_defaults = mod_proxy_set_defaults;
p->connection_reset = gw_connection_reset;
p->handle_request_reset = gw_handle_request_reset;
p->handle_uri_clean = mod_proxy_check_extension;
p->handle_subrequest = gw_handle_subrequest;
p->handle_trigger = gw_handle_trigger;

2
src/mod_rewrite.c

@ -350,7 +350,7 @@ int mod_rewrite_plugin_init(plugin *p) {
p->handle_uri_raw = mod_rewrite_uri_handler;
p->handle_physical = mod_rewrite_physical;
p->cleanup = mod_rewrite_free;
p->connection_reset = mod_rewrite_con_reset;
p->handle_request_reset = mod_rewrite_con_reset;
p->set_defaults = mod_rewrite_set_defaults;
return 0;

2
src/mod_scgi.c

@ -321,7 +321,7 @@ int mod_scgi_plugin_init(plugin *p) {
p->init = gw_init;
p->cleanup = gw_free;
p->set_defaults = mod_scgi_set_defaults;
p->connection_reset = gw_connection_reset;
p->handle_request_reset = gw_handle_request_reset;
p->handle_uri_clean = scgi_check_extension_1;
p->handle_subrequest_start = scgi_check_extension_2;
p->handle_subrequest = gw_handle_subrequest;

6
src/mod_setenv.c

@ -248,7 +248,7 @@ REQUEST_FUNC(mod_setenv_handle_response_start) {
return HANDLER_GO_ON;
}
REQUEST_FUNC(mod_setenv_reset) {
REQUEST_FUNC(mod_setenv_handle_request_reset) {
void ** const hctx = r->plugin_ctx+((plugin_data_base *)p_d)->id;
if (*hctx) { handler_ctx_free(*hctx); *hctx = NULL; }
return HANDLER_GO_ON;
@ -260,12 +260,12 @@ int mod_setenv_plugin_init(plugin *p) {
p->name = "setenv";
p->init = mod_setenv_init;
p->set_defaults= mod_setenv_set_defaults;
p->handle_uri_clean = mod_setenv_uri_handler;
p->handle_request_env = mod_setenv_handle_request_env;
p->handle_response_start = mod_setenv_handle_response_start;
p->set_defaults = mod_setenv_set_defaults;
p->handle_request_reset = mod_setenv_handle_request_reset;
p->connection_reset = mod_setenv_reset;
return 0;
}

2
src/mod_sockproxy.c

@ -177,7 +177,7 @@ int mod_sockproxy_plugin_init(plugin *p) {
p->init = gw_init;
p->cleanup = gw_free;
p->set_defaults = mod_sockproxy_set_defaults;
p->connection_reset = gw_connection_reset;
p->handle_request_reset = gw_handle_request_reset;
p->handle_connection_accept= mod_sockproxy_connection_accept;
p->handle_subrequest = gw_handle_subrequest;
p->handle_trigger = gw_handle_trigger;

4
src/mod_ssi.c

@ -1289,7 +1289,7 @@ SUBREQUEST_FUNC(mod_ssi_handle_subrequest) {
return HANDLER_FINISHED;
}
static handler_t mod_ssi_connection_reset(request_st * const r, void *p_d) {
static handler_t mod_ssi_handle_request_reset(request_st * const r, void *p_d) {
plugin_data *p = p_d;
handler_ctx *hctx = r->plugin_ctx[p->id];
if (hctx) {
@ -1309,7 +1309,7 @@ int mod_ssi_plugin_init(plugin *p) {
p->init = mod_ssi_init;
p->handle_subrequest_start = mod_ssi_physical_path;
p->handle_subrequest = mod_ssi_handle_subrequest;
p->connection_reset = mod_ssi_connection_reset;
p->handle_request_reset = mod_ssi_handle_request_reset;
p->set_defaults = mod_ssi_set_defaults;
p->cleanup = mod_ssi_free;

2
src/mod_uploadprogress.c

@ -325,7 +325,7 @@ int mod_uploadprogress_plugin_init(plugin *p) {
p->init = mod_uploadprogress_init;
p->handle_uri_clean = mod_uploadprogress_uri_handler;
p->connection_reset = mod_uploadprogress_request_done;
p->handle_request_reset = mod_uploadprogress_request_done;
p->set_defaults = mod_uploadprogress_set_defaults;
p->cleanup = mod_uploadprogress_free;

4
src/mod_vhostdb.c

@ -239,7 +239,7 @@ SETDEFAULTS_FUNC(mod_vhostdb_set_defaults) {
return HANDLER_GO_ON;
}
REQUEST_FUNC(mod_vhostdb_handle_connection_reset) {
REQUEST_FUNC(mod_vhostdb_handle_request_reset) {
plugin_data *p = p_d;
vhostdb_cache_entry *ve;
@ -398,7 +398,7 @@ int mod_vhostdb_plugin_init(plugin *p) {
p->set_defaults = mod_vhostdb_set_defaults;
p->handle_trigger = mod_vhostdb_periodic;
p->handle_docroot = mod_vhostdb_handle_docroot;
p->connection_reset = mod_vhostdb_handle_connection_reset;
p->handle_request_reset = mod_vhostdb_handle_request_reset;
return 0;
}

2
src/mod_webdav.c

@ -254,7 +254,7 @@ int mod_webdav_plugin_init(plugin *p) {
p->handle_uri_clean = mod_webdav_uri_handler;
p->handle_physical = mod_webdav_physical_handler;
p->handle_subrequest = mod_webdav_subrequest_handler;
p->connection_reset = mod_webdav_handle_reset;
p->handle_request_reset = mod_webdav_handle_reset;
return 0;
}

6
src/mod_wstunnel.c

@ -381,7 +381,7 @@ static handler_t wstunnel_stdin_append(gw_handler_ctx *gwhctx) {
DEBUG_LOG_INFO("disconnected from client (fd=%d)", r->con->fd);
DEBUG_LOG_DEBUG("send close response to client (fd=%d)", r->con->fd);
mod_wstunnel_frame_send(hctx, MOD_WEBSOCKET_FRAME_TYPE_CLOSE, CONST_STR_LEN("1000")); /* 1000 Normal Closure */
gw_connection_reset(r, hctx->gw.plugin_data);
gw_handle_request_reset(r, hctx->gw.plugin_data);
return HANDLER_FINISHED;
}
}
@ -605,7 +605,7 @@ TRIGGER_FUNC(mod_wstunnel_handle_trigger) {
if (cur_ts - con->read_idle_ts > r->conf.max_read_idle) {
DEBUG_LOG_INFO("timeout client (fd=%d)", con->fd);
mod_wstunnel_frame_send(hctx,MOD_WEBSOCKET_FRAME_TYPE_CLOSE,NULL,0);
gw_connection_reset(r, p_d);
gw_handle_request_reset(r, p_d);
joblist_append(con);
/* avoid server.c closing connection with error due to max_read_idle
* (might instead run joblist after plugins_call_handle_trigger())*/
@ -633,7 +633,7 @@ int mod_wstunnel_plugin_init(plugin *p) {
p->init = mod_wstunnel_init;
p->cleanup = gw_free;
p->set_defaults = mod_wstunnel_set_defaults;
p->connection_reset = gw_connection_reset;
p->handle_request_reset = gw_handle_request_reset;
p->handle_uri_clean = mod_wstunnel_check_extension;
p->handle_subrequest = gw_handle_subrequest;
p->handle_trigger = mod_wstunnel_handle_trigger;

6
src/plugin.c

@ -353,7 +353,7 @@ PLUGIN_CALL_FN_REQ_DATA(PLUGIN_FUNC_HANDLE_SUBREQUEST_START, handle_subrequest_s
PLUGIN_CALL_FN_REQ_DATA(PLUGIN_FUNC_HANDLE_RESPONSE_START, handle_response_start)
PLUGIN_CALL_FN_REQ_DATA(PLUGIN_FUNC_HANDLE_DOCROOT, handle_docroot)
PLUGIN_CALL_FN_REQ_DATA(PLUGIN_FUNC_HANDLE_PHYSICAL, handle_physical)
PLUGIN_CALL_FN_REQ_DATA(PLUGIN_FUNC_CONNECTION_RESET, connection_reset)
PLUGIN_CALL_FN_REQ_DATA(PLUGIN_FUNC_CONNECTION_RESET, handle_request_reset)
/**
* plugins that use
@ -502,7 +502,7 @@ handler_t plugins_call_init(server *srv) {
++offsets[PLUGIN_FUNC_HANDLE_DOCROOT];
if (p->handle_physical)
++offsets[PLUGIN_FUNC_HANDLE_PHYSICAL];
if (p->connection_reset)
if (p->handle_request_reset)
++offsets[PLUGIN_FUNC_CONNECTION_RESET];
if (p->set_defaults)
++offsets[PLUGIN_FUNC_SET_DEFAULTS];
@ -557,7 +557,7 @@ handler_t plugins_call_init(server *srv) {
offsets[PLUGIN_FUNC_HANDLE_DOCROOT]);
plugins_call_init_slot(srv, p->handle_physical, p->data,
offsets[PLUGIN_FUNC_HANDLE_PHYSICAL]);
plugins_call_init_slot(srv, p->connection_reset, p->data,
plugins_call_init_slot(srv, p->handle_request_reset, p->data,
offsets[PLUGIN_FUNC_CONNECTION_RESET]);
plugins_call_init_slot(srv, p->set_defaults, p->data,
offsets[PLUGIN_FUNC_SET_DEFAULTS]);

4
src/plugin.h

@ -71,7 +71,7 @@ struct plugin {
handler_t (* handle_subrequest_start) (request_st *r, void *p_d); /* when handler for request not found yet */
handler_t (* handle_subrequest) (request_st *r, void *p_d); /* handler for request (max one per request) */
handler_t (* handle_response_start) (request_st *r, void *p_d); /* before response headers are written */
handler_t (* connection_reset) (request_st *r, void *p_d); /* after request done or request abort */
handler_t (* handle_request_reset) (request_st *r, void *p_d); /* after request done or request abort */
handler_t (* handle_connection_accept) (connection *con, void *p_d); /* after accept() socket */
handler_t (* handle_connection_shut_wr)(connection *con, void *p_d); /* done writing to socket */
@ -106,7 +106,7 @@ handler_t plugins_call_handle_request_env(request_st *r);
handler_t plugins_call_handle_request_done(request_st *r);
handler_t plugins_call_handle_docroot(request_st *r);
handler_t plugins_call_handle_physical(request_st *r);
handler_t plugins_call_connection_reset(request_st *r);
handler_t plugins_call_handle_request_reset(request_st *r);
handler_t plugins_call_handle_connection_accept(connection *con);
handler_t plugins_call_handle_connection_shut_wr(connection *con);

Loading…
Cancel
Save