Lines 41-46
typedef struct {
Link Here
|
41 |
apr_sockaddr_t *backend_addrs; |
41 |
apr_sockaddr_t *backend_addrs; |
42 |
int is_authn; |
42 |
int is_authn; |
43 |
int is_authz; |
43 |
int is_authz; |
|
|
44 |
int timeout; /* socket io timeout */ |
44 |
} fcgi_provider_conf; |
45 |
} fcgi_provider_conf; |
45 |
|
46 |
|
46 |
typedef struct { |
47 |
typedef struct { |
Lines 63-70
typedef struct {
Link Here
|
63 |
|
64 |
|
64 |
static apr_hash_t *fcgi_authn_providers, *fcgi_authz_providers; |
65 |
static apr_hash_t *fcgi_authn_providers, *fcgi_authz_providers; |
65 |
|
66 |
|
66 |
#define FCGI_IO_TIMEOUT apr_time_from_sec(30) |
|
|
67 |
|
68 |
#ifndef NON200_RESPONSE_BUF_LEN |
67 |
#ifndef NON200_RESPONSE_BUF_LEN |
69 |
#define NON200_RESPONSE_BUF_LEN 8192 |
68 |
#define NON200_RESPONSE_BUF_LEN 8192 |
70 |
#endif |
69 |
#endif |
Lines 72-77
static apr_hash_t *fcgi_authn_providers,
Link Here
|
72 |
/* fcgi://{hostname|IPv4|IPv6}:port[/] */ |
71 |
/* fcgi://{hostname|IPv4|IPv6}:port[/] */ |
73 |
#define FCGI_BACKEND_REGEX_STR "m%^fcgi://(.*):(\\d{1,5})/?$%" |
72 |
#define FCGI_BACKEND_REGEX_STR "m%^fcgi://(.*):(\\d{1,5})/?$%" |
74 |
|
73 |
|
|
|
74 |
/* Optional socket IO timeout parameter regex. For e.g.: timeout=60 */ |
75 |
#define FCGI_IO_TIMEOUT_REGEX_STR "m%^timeout=(\\d{1,3})$%" |
76 |
|
75 |
/* |
77 |
/* |
76 |
* utility function to connect to a peer; generally useful, but |
78 |
* utility function to connect to a peer; generally useful, but |
77 |
* wait for AF_UNIX support in this mod before thinking about how |
79 |
* wait for AF_UNIX support in this mod before thinking about how |
Lines 718-724
static void req_rsp(request_rec *r, cons
Link Here
|
718 |
setupenv(r, password, apache_role); |
720 |
setupenv(r, password, apache_role); |
719 |
|
721 |
|
720 |
rv = connect_to_peer(&s, r, conf->backend_addrs, |
722 |
rv = connect_to_peer(&s, r, conf->backend_addrs, |
721 |
conf->backend, FCGI_IO_TIMEOUT); |
723 |
conf->backend, apr_time_from_sec(conf->timeout)); |
722 |
if (rv == APR_SUCCESS) { |
724 |
if (rv == APR_SUCCESS) { |
723 |
apr_uint16_t request_id = 1; |
725 |
apr_uint16_t request_id = 1; |
724 |
|
726 |
|
Lines 1163-1169
static const char *fcgi_define_provider(
Link Here
|
1163 |
char *const argv[]) |
1165 |
char *const argv[]) |
1164 |
{ |
1166 |
{ |
1165 |
const char *dname = "AuthnzFcgiDefineProvider"; |
1167 |
const char *dname = "AuthnzFcgiDefineProvider"; |
1166 |
ap_rxplus_t *fcgi_backend_regex; |
1168 |
ap_rxplus_t *fcgi_backend_regex, *fcgi_io_timeout_regex; |
1167 |
apr_status_t rv; |
1169 |
apr_status_t rv; |
1168 |
char *host; |
1170 |
char *host; |
1169 |
const char *err, *stype; |
1171 |
const char *err, *stype; |
Lines 1177-1182
static const char *fcgi_define_provider(
Link Here
|
1177 |
dname, FCGI_BACKEND_REGEX_STR); |
1179 |
dname, FCGI_BACKEND_REGEX_STR); |
1178 |
} |
1180 |
} |
1179 |
|
1181 |
|
|
|
1182 |
fcgi_io_timeout_regex = ap_rxplus_compile(cmd->pool, FCGI_IO_TIMEOUT_REGEX_STR); |
1183 |
if (!fcgi_io_timeout_regex) { |
1184 |
return apr_psprintf(cmd->pool, |
1185 |
"%s: failed to compile regexec '%s'", |
1186 |
dname, FCGI_IO_TIMEOUT_REGEX_STR); |
1187 |
} |
1188 |
|
1180 |
err = ap_check_cmd_context(cmd, GLOBAL_ONLY); |
1189 |
err = ap_check_cmd_context(cmd, GLOBAL_ONLY); |
1181 |
if (err) |
1190 |
if (err) |
1182 |
return err; |
1191 |
return err; |
Lines 1257-1262
static const char *fcgi_define_provider(
Link Here
|
1257 |
NULL); |
1266 |
NULL); |
1258 |
} |
1267 |
} |
1259 |
|
1268 |
|
|
|
1269 |
if ((ca <= argc) && !strncmp(argv[ca], "timeout=", strlen("timeout="))) { |
1270 |
rc = ap_rxplus_exec(cmd->pool, fcgi_io_timeout_regex, argv[ca], NULL); |
1271 |
if (!rc || ap_rxplus_nmatch(fcgi_io_timeout_regex) != 2) { |
1272 |
return apr_pstrcat(cmd->pool, dname, ": timeout parameter '", |
1273 |
argv[ca], "' has invalid form", NULL); |
1274 |
} |
1275 |
ca++; |
1276 |
conf->timeout = atoi(ap_rxplus_pmatch(cmd->pool, fcgi_io_timeout_regex, 1)); |
1277 |
} |
1278 |
|
1260 |
if (ca != argc) { |
1279 |
if (ca != argc) { |
1261 |
return apr_pstrcat(cmd->pool, |
1280 |
return apr_pstrcat(cmd->pool, |
1262 |
dname, |
1281 |
dname, |