Browse Source

remove handle_joblist hook

remove handle_joblist hook and remove the hooks defined in
mod_fastcgi and mod_scgi.  The calls made to fdevent management
are redundant.  If the calls were actually needed, then
mod_proxy would have needed a handle_joblist handler, too.
personal/stbuehler/mod-csrf-old
Glenn Strauss 6 years ago
parent
commit
7f942ce09a
  1. 30
      src/mod_fastcgi.c
  2. 30
      src/mod_scgi.c
  3. 11
      src/network.c
  4. 3
      src/plugin.c
  5. 3
      src/plugin.h
  6. 12
      src/server.c

30
src/mod_fastcgi.c

@ -3563,35 +3563,6 @@ static handler_t fcgi_check_extension_2(server *srv, connection *con, void *p_d)
return fcgi_check_extension(srv, con, p_d, 0);
}
JOBLIST_FUNC(mod_fastcgi_handle_joblist) {
plugin_data *p = p_d;
handler_ctx *hctx = con->plugin_ctx[p->id];
if (hctx == NULL) return HANDLER_GO_ON;
if (hctx->fd != -1) {
switch (hctx->state) {
case FCGI_STATE_READ:
fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN);
break;
case FCGI_STATE_CONNECT_DELAYED:
case FCGI_STATE_WRITE:
fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT);
break;
case FCGI_STATE_INIT:
/* at reconnect */
break;
default:
log_error_write(srv, __FILE__, __LINE__, "sd", "unhandled fcgi.state", hctx->state);
break;
}
}
return HANDLER_GO_ON;
}
TRIGGER_FUNC(mod_fastcgi_handle_trigger) {
plugin_data *p = p_d;
@ -3701,7 +3672,6 @@ int mod_fastcgi_plugin_init(plugin *p) {
p->handle_uri_clean = fcgi_check_extension_1;
p->handle_subrequest_start = fcgi_check_extension_2;
p->handle_subrequest = mod_fastcgi_handle_subrequest;
p->handle_joblist = mod_fastcgi_handle_joblist;
p->handle_trigger = mod_fastcgi_handle_trigger;
p->data = NULL;

30
src/mod_scgi.c

@ -2853,35 +2853,6 @@ static handler_t scgi_check_extension_2(server *srv, connection *con, void *p_d)
return scgi_check_extension(srv, con, p_d, 0);
}
JOBLIST_FUNC(mod_scgi_handle_joblist) {
plugin_data *p = p_d;
handler_ctx *hctx = con->plugin_ctx[p->id];
if (hctx == NULL) return HANDLER_GO_ON;
if (hctx->fd != -1) {
switch (hctx->state) {
case FCGI_STATE_READ:
fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN);
break;
case FCGI_STATE_CONNECT:
case FCGI_STATE_WRITE:
fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT);
break;
case FCGI_STATE_INIT:
/* at reconnect */
break;
default:
log_error_write(srv, __FILE__, __LINE__, "sd", "unhandled fcgi.state", hctx->state);
break;
}
}
return HANDLER_GO_ON;
}
TRIGGER_FUNC(mod_scgi_handle_trigger) {
plugin_data *p = p_d;
@ -3088,7 +3059,6 @@ int mod_scgi_plugin_init(plugin *p) {
p->handle_uri_clean = scgi_check_extension_1;
p->handle_subrequest_start = scgi_check_extension_2;
p->handle_subrequest = mod_scgi_handle_subrequest;
p->handle_joblist = mod_scgi_handle_joblist;
p->handle_trigger = mod_scgi_handle_trigger;
p->data = NULL;

11
src/network.c

@ -69,18 +69,7 @@ static handler_t network_server_handle_fdevent(server *srv, void *context, int r
*
* we jump out after 100 to give the waiting connections a chance */
for (loops = 0; loops < 100 && NULL != (con = connection_accept(srv, srv_socket)); loops++) {
handler_t r;
connection_state_machine(srv, con);
switch(r = plugins_call_handle_joblist(srv, con)) {
case HANDLER_FINISHED:
case HANDLER_GO_ON:
break;
default:
log_error_write(srv, __FILE__, __LINE__, "d", r);
break;
}
}
return HANDLER_GO_ON;
}

3
src/plugin.c

@ -40,7 +40,6 @@ typedef enum {
PLUGIN_FUNC_HANDLE_SIGHUP,
PLUGIN_FUNC_HANDLE_SUBREQUEST,
PLUGIN_FUNC_HANDLE_SUBREQUEST_START,
PLUGIN_FUNC_HANDLE_JOBLIST,
PLUGIN_FUNC_HANDLE_DOCROOT,
PLUGIN_FUNC_HANDLE_PHYSICAL,
PLUGIN_FUNC_CONNECTION_RESET,
@ -329,7 +328,6 @@ PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_REQUEST_DONE, handle_request_done)
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_CONNECTION_CLOSE, handle_connection_close)
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SUBREQUEST, handle_subrequest)
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SUBREQUEST_START, handle_subrequest_start)
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_JOBLIST, handle_joblist)
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_DOCROOT, handle_docroot)
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_PHYSICAL, handle_physical)
PLUGIN_TO_SLOT(PLUGIN_FUNC_CONNECTION_RESET, connection_reset)
@ -460,7 +458,6 @@ handler_t plugins_call_init(server *srv) {
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SIGHUP, handle_sighup);
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SUBREQUEST, handle_subrequest);
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SUBREQUEST_START, handle_subrequest_start);
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_JOBLIST, handle_joblist);
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_DOCROOT, handle_docroot);
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_PHYSICAL, handle_physical);
PLUGIN_TO_SLOT(PLUGIN_FUNC_CONNECTION_RESET, connection_reset);

3
src/plugin.h

@ -20,7 +20,6 @@
#define SIGHUP_FUNC SERVER_FUNC
#define SUBREQUEST_FUNC CONNECTION_FUNC
#define JOBLIST_FUNC CONNECTION_FUNC
#define PHYSICALPATH_FUNC CONNECTION_FUNC
#define REQUESTDONE_FUNC CONNECTION_FUNC
#define URIHANDLER_FUNC CONNECTION_FUNC
@ -45,7 +44,6 @@ typedef struct {
handler_t (* handle_physical) (server *srv, connection *con, void *p_d); /* mapping url to physical path */
handler_t (* handle_request_done) (server *srv, connection *con, void *p_d); /* at the end of a request */
handler_t (* handle_connection_close)(server *srv, connection *con, void *p_d); /* at the end of a connection */
handler_t (* handle_joblist) (server *srv, connection *con, void *p_d); /* after all events are handled */
@ -73,7 +71,6 @@ handler_t plugins_call_handle_request_done(server *srv, connection *con);
handler_t plugins_call_handle_docroot(server *srv, connection *con);
handler_t plugins_call_handle_physical(server *srv, connection *con);
handler_t plugins_call_handle_connection_close(server *srv, connection *con);
handler_t plugins_call_handle_joblist(server *srv, connection *con);
handler_t plugins_call_connection_reset(server *srv, connection *con);
handler_t plugins_call_handle_trigger(server *srv);

12
src/server.c

@ -1632,19 +1632,7 @@ int main (int argc, char **argv) {
for (ndx = 0; ndx < srv->joblist->used; ndx++) {
connection *con = srv->joblist->ptr[ndx];
handler_t r;
connection_state_machine(srv, con);
switch(r = plugins_call_handle_joblist(srv, con)) {
case HANDLER_FINISHED:
case HANDLER_GO_ON:
break;
default:
log_error_write(srv, __FILE__, __LINE__, "d", r);
break;
}
con->in_joblist = 0;
}

Loading…
Cancel
Save