Browse Source

[mod_fastcgi,mod_scgi] struct member consistency

personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
35c4bf5857
  1. 16
      src/mod_fastcgi.c
  2. 39
      src/mod_scgi.c

16
src/mod_fastcgi.c

@ -62,6 +62,7 @@ typedef struct fcgi_proc {
size_t load; /* number of requests waiting on this process */
time_t last_used; /* see idle_timeout */
size_t requests; /* see max_requests */
struct fcgi_proc *prev, *next; /* see first */
@ -103,10 +104,23 @@ typedef struct {
*
*/
unsigned short min_procs;
unsigned short max_procs;
size_t num_procs; /* how many procs are started */
size_t active_procs; /* how many of them are really running, i.e. state = PROC_STATE_RUNNING */
unsigned short max_load_per_proc;
/*
* kick the process from the list if it was not
* used for idle_timeout until min_procs is
* reached. this helps to get the processlist
* small again we had a small peak load.
*
*/
unsigned short idle_timeout;
/*
* time after a disabled remote connection is tried to be re-enabled
*
@ -216,7 +230,7 @@ typedef struct {
unsigned short xsendfile_allow;
array *xsendfile_docroot;
ssize_t load; /* replace by host->load */
ssize_t load;
size_t max_id; /* corresponds most of the time to num_procs */

39
src/mod_scgi.c

@ -29,13 +29,10 @@
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
enum {EOL_UNSET, EOL_N, EOL_RN};
/*
*
* TODO:
@ -75,6 +72,9 @@ typedef struct scgi_proc {
} scgi_proc;
typedef struct {
/* the key that is used to reference this value */
buffer *id;
/* list of processes handling this extension
* sorted by lowest load
*
@ -201,6 +201,8 @@ typedef struct {
*
*/
unsigned short break_scriptfilename_for_php;
/*
* workaround for program when prefix="/"
*
@ -219,10 +221,17 @@ typedef struct {
unsigned short xsendfile_allow;
array *xsendfile_docroot;
ssize_t load; /* replace by host->load */
ssize_t load;
size_t max_id; /* corresponds most of the time to num_procs */
buffer *strip_request_uri;
unsigned short kill_signal; /* we need a setting for this as libfcgi
applications prefer SIGUSR1 while the
rest of the world would use SIGTERM
*sigh* */
int listen_backlog;
int refcount;
} scgi_extension_host;
@ -250,6 +259,8 @@ typedef struct {
buffer *key; /* like .php */
int note_is_sent;
int last_used_ndx;
scgi_extension_host **hosts;
size_t used;
@ -291,22 +302,30 @@ typedef struct {
} plugin_data;
/* connection specific data */
typedef enum { FCGI_STATE_INIT, FCGI_STATE_CONNECT, FCGI_STATE_PREPARE_WRITE,
FCGI_STATE_WRITE, FCGI_STATE_READ
typedef enum {
FCGI_STATE_INIT,
FCGI_STATE_CONNECT,
FCGI_STATE_PREPARE_WRITE,
FCGI_STATE_WRITE,
FCGI_STATE_READ
} scgi_connection_state_t;
typedef struct {
buffer *response;
scgi_proc *proc;
scgi_extension_host *host;
scgi_extension *ext;
scgi_extension *ext_auth;
unsigned short scgi_mode;
scgi_connection_state_t state;
time_t state_timestamp;
chunkqueue *rb;
chunkqueue *wb;
off_t wb_reqlen;
buffer *response;
int fd; /* fd to the scgi process */
int fde_ndx; /* index into the fd-event buffer */
@ -314,12 +333,14 @@ typedef struct {
int got_proc;
int reconnects; /* number of reconnect attempts */
int request_id;
int send_content_body;
http_response_opts opts;
plugin_config conf;
connection *remote_conn; /* dumb pointer */
plugin_data *plugin_data; /* dumb pointer */
scgi_extension *ext;
} handler_ctx;

Loading…
Cancel
Save