Lines Matching refs:host

158 	buffer *host;  member
342 fcgi_extension_host *host; member
389 static void fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) { in fastcgi_status_copy_procname() argument
391 buffer_append_string_buffer(b, host->id); in fastcgi_status_copy_procname()
404 fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); in fcgi_proc_load_inc()
416 fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); in fcgi_proc_load_dec()
422 static void fcgi_host_assign(server *srv, handler_ctx *hctx, fcgi_extension_host *host) { in fcgi_host_assign() argument
424 hctx->host = host; in fcgi_host_assign()
425 hctx->host->load++; in fcgi_host_assign()
427 fastcgi_status_copy_procname(p->statuskey, hctx->host, NULL); in fcgi_host_assign()
430 status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->host->load); in fcgi_host_assign()
435 hctx->host->load--; in fcgi_host_reset()
437 fastcgi_status_copy_procname(p->statuskey, hctx->host, NULL); in fcgi_host_reset()
440 status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->host->load); in fcgi_host_reset()
442 hctx->host = NULL; in fcgi_host_reset()
448 if (hctx->host->disable_time || hctx->proc->is_local) { in fcgi_host_disable()
449 if (hctx->proc->state == PROC_STATE_RUNNING) hctx->host->active_procs--; in fcgi_host_disable()
450 hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; in fcgi_host_disable()
455 "backend disabled for", hctx->host->disable_time, "seconds"); in fcgi_host_disable()
460 static int fastcgi_status_init(server *srv, buffer *b, fcgi_extension_host *host, fcgi_proc *proc) { in fastcgi_status_init() argument
462 fastcgi_status_copy_procname(b, host, proc); \ in fastcgi_status_init()
475 fastcgi_status_copy_procname(b, host, NULL); \ in fastcgi_status_init()
512 if (hctx->host) { in handler_ctx_free()
554 f->host = buffer_init(); in fastcgi_host_init()
569 buffer_free(h->host); in fastcgi_host_free()
717 fcgi_extension_host *host; in FREE_FUNC() local
719 host = ex->hosts[n]; in FREE_FUNC()
721 for (proc = host->first; proc; proc = proc->next) { in FREE_FUNC()
723 kill(proc->pid, host->kill_signal); in FREE_FUNC()
732 for (proc = host->unused_procs; proc; proc = proc->next) { in FREE_FUNC()
734 kill(proc->pid, host->kill_signal); in FREE_FUNC()
849 fcgi_extension_host *host, in fcgi_spawn_connection() argument
898 if (buffer_is_empty(host->host)) { in fcgi_spawn_connection()
907 if (NULL == (he = gethostbyname(host->host->ptr))) { in fcgi_spawn_connection()
910 h_errno, host->host); in fcgi_spawn_connection()
934 if (!buffer_is_empty(host->host)) { in fcgi_spawn_connection()
935 buffer_append_string_buffer(proc->connection_name, host->host); in fcgi_spawn_connection()
1019 if (host->bin_env_copy->used) { in fcgi_spawn_connection()
1020 for (i = 0; i < host->bin_env_copy->used; i++) { in fcgi_spawn_connection()
1021 data_string *ds = (data_string *)host->bin_env_copy->data[i]; in fcgi_spawn_connection()
1039 for (i = 0; i < host->bin_env->used; i++) { in fcgi_spawn_connection()
1040 data_string *ds = (data_string *)host->bin_env->data[i]; in fcgi_spawn_connection()
1057 parse_binpath(&arg, host->bin_path); in fcgi_spawn_connection()
1104 "the fastcgi-backend", host->bin_path, "failed to start:"); in fcgi_spawn_connection()
1109 WEXITSTATUS(status), host->bin_path); in fcgi_spawn_connection()
1151 host->active_procs++; in fcgi_spawn_connection()
1242 fcgi_extension_host *host; in SETDEFAULTS_FUNC() local
1277 host = fastcgi_host_init(); in SETDEFAULTS_FUNC()
1279 buffer_copy_string_buffer(host->id, da_host->key); in SETDEFAULTS_FUNC()
1281 host->check_local = 1; in SETDEFAULTS_FUNC()
1282 host->max_procs = 4; in SETDEFAULTS_FUNC()
1283 host->mode = FCGI_RESPONDER; in SETDEFAULTS_FUNC()
1284 host->disable_time = 1; in SETDEFAULTS_FUNC()
1285 host->break_scriptfilename_for_php = 0; in SETDEFAULTS_FUNC()
1286 host->allow_xsendfile = 0; /* handle X-LIGHTTPD-send-file */ in SETDEFAULTS_FUNC()
1287 host->kill_signal = SIGTERM; in SETDEFAULTS_FUNC()
1288 host->fix_root_path_name = 0; in SETDEFAULTS_FUNC()
1290 fcv[0].destination = host->host; in SETDEFAULTS_FUNC()
1291 fcv[1].destination = host->docroot; in SETDEFAULTS_FUNC()
1293 fcv[3].destination = host->unixsocket; in SETDEFAULTS_FUNC()
1294 fcv[4].destination = host->bin_path; in SETDEFAULTS_FUNC()
1296 fcv[5].destination = &(host->check_local); in SETDEFAULTS_FUNC()
1297 fcv[6].destination = &(host->port); in SETDEFAULTS_FUNC()
1298 fcv[7].destination = &(host->max_procs); in SETDEFAULTS_FUNC()
1299 fcv[8].destination = &(host->disable_time); in SETDEFAULTS_FUNC()
1301 fcv[9].destination = host->bin_env; in SETDEFAULTS_FUNC()
1302 fcv[10].destination = host->bin_env_copy; in SETDEFAULTS_FUNC()
1303 fcv[11].destination = &(host->break_scriptfilename_for_php); in SETDEFAULTS_FUNC()
1304 fcv[12].destination = &(host->allow_xsendfile); in SETDEFAULTS_FUNC()
1305 fcv[13].destination = host->strip_request_uri; in SETDEFAULTS_FUNC()
1306 fcv[14].destination = &(host->kill_signal); in SETDEFAULTS_FUNC()
1307 fcv[15].destination = &(host->fix_root_path_name); in SETDEFAULTS_FUNC()
1313 if ((!buffer_is_empty(host->host) || host->port) && in SETDEFAULTS_FUNC()
1314 !buffer_is_empty(host->unixsocket)) { in SETDEFAULTS_FUNC()
1324 if (!buffer_is_empty(host->unixsocket)) { in SETDEFAULTS_FUNC()
1328 if (host->unixsocket->used > sizeof(un.sun_path) - 2) { in SETDEFAULTS_FUNC()
1340 if (buffer_is_empty(host->host) && in SETDEFAULTS_FUNC()
1341 buffer_is_empty(host->bin_path)) { in SETDEFAULTS_FUNC()
1349 } else if (host->port == 0) { in SETDEFAULTS_FUNC()
1360 if (!buffer_is_empty(host->bin_path)) { in SETDEFAULTS_FUNC()
1367 "\n\tproc:", host->bin_path, in SETDEFAULTS_FUNC()
1368 "\n\tport:", host->port, in SETDEFAULTS_FUNC()
1369 "\n\tsocket", host->unixsocket, in SETDEFAULTS_FUNC()
1370 "\n\tmax-procs:", host->max_procs); in SETDEFAULTS_FUNC()
1373 for (pno = 0; pno < host->max_procs; pno++) { in SETDEFAULTS_FUNC()
1377 proc->id = host->num_procs++; in SETDEFAULTS_FUNC()
1378 host->max_id++; in SETDEFAULTS_FUNC()
1380 if (buffer_is_empty(host->unixsocket)) { in SETDEFAULTS_FUNC()
1381 proc->port = host->port + pno; in SETDEFAULTS_FUNC()
1383 buffer_copy_string_buffer(proc->unixsocket, host->unixsocket); in SETDEFAULTS_FUNC()
1391 "\n\tport:", host->port, in SETDEFAULTS_FUNC()
1392 "\n\tsocket", host->unixsocket, in SETDEFAULTS_FUNC()
1393 "\n\tcurrent:", pno, "/", host->max_procs); in SETDEFAULTS_FUNC()
1396 if (fcgi_spawn_connection(srv, p, host, proc)) { in SETDEFAULTS_FUNC()
1402 fastcgi_status_init(srv, p->statuskey, host, proc); in SETDEFAULTS_FUNC()
1404 proc->next = host->first; in SETDEFAULTS_FUNC()
1405 if (host->first) host->first->prev = proc; in SETDEFAULTS_FUNC()
1407 host->first = proc; in SETDEFAULTS_FUNC()
1413 proc->id = host->num_procs++; in SETDEFAULTS_FUNC()
1414 host->max_id++; in SETDEFAULTS_FUNC()
1415 host->active_procs++; in SETDEFAULTS_FUNC()
1418 if (buffer_is_empty(host->unixsocket)) { in SETDEFAULTS_FUNC()
1419 proc->port = host->port; in SETDEFAULTS_FUNC()
1421 buffer_copy_string_buffer(proc->unixsocket, host->unixsocket); in SETDEFAULTS_FUNC()
1424 fastcgi_status_init(srv, p->statuskey, host, proc); in SETDEFAULTS_FUNC()
1426 host->first = proc; in SETDEFAULTS_FUNC()
1428 host->max_procs = 1; in SETDEFAULTS_FUNC()
1433 host->mode = FCGI_RESPONDER; in SETDEFAULTS_FUNC()
1435 host->mode = FCGI_AUTHORIZER; in SETDEFAULTS_FUNC()
1436 if (buffer_is_empty(host->docroot)) { in SETDEFAULTS_FUNC()
1449 fastcgi_extension_insert(s->exts, da_ext->key, host); in SETDEFAULTS_FUNC()
1484 if (hctx->host && hctx->proc) { in fcgi_connection_close()
1547 hctx->host->unixsocket); in fcgi_reconnect()
1654 fcgi_extension_host *host = hctx->host; in fcgi_establish_connection() local
1683 if (!buffer_is_empty(host->host)) { in fcgi_establish_connection()
1684 if (0 == inet_aton(host->host->ptr, &(fcgi_addr_in.sin_addr))) { in fcgi_establish_connection()
1686 "converting IP address failed for", host->host, in fcgi_establish_connection()
1702 if (!buffer_is_empty(host->host)) { in fcgi_establish_connection()
1703 buffer_append_string_buffer(proc->connection_name, host->host); in fcgi_establish_connection()
1828 fcgi_extension_host *host= hctx->host; in fcgi_create_env() local
1839 beginRecord.body.roleB0 = host->mode; in fcgi_create_env()
1922 if (con->request.content_length > 0 && host->mode != FCGI_AUTHORIZER) { in fcgi_create_env()
1930 if (host->mode != FCGI_AUTHORIZER) { in fcgi_create_env()
1945 if (!buffer_is_empty(host->docroot)) { in fcgi_create_env()
1946 buffer_copy_string_buffer(p->path, host->docroot); in fcgi_create_env()
1965 if (!buffer_is_empty(host->docroot)) { in fcgi_create_env()
1971 buffer_copy_string_buffer(p->path, host->docroot); in fcgi_create_env()
1975 …FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(host->d… in fcgi_create_env()
1983 if (host->break_scriptfilename_for_php) { in fcgi_create_env()
1991 if (host->strip_request_uri->used > 1) { in fcgi_create_env()
2001 if ('/' != host->strip_request_uri->ptr[host->strip_request_uri->used - 2]) { in fcgi_create_env()
2003 buffer_append_string_len(host->strip_request_uri, CONST_STR_LEN("/")); in fcgi_create_env()
2006 if (con->request.orig_uri->used >= host->strip_request_uri->used && in fcgi_create_env()
2007 …0 == strncmp(con->request.orig_uri->ptr, host->strip_request_uri->ptr, host->strip_request_uri->us… in fcgi_create_env()
2011 con->request.orig_uri->ptr + (host->strip_request_uri->used - 2), in fcgi_create_env()
2012 con->request.orig_uri->used - (host->strip_request_uri->used - 2) - 1); in fcgi_create_env()
2180 fcgi_extension_host *host= hctx->host; in fcgi_response_parse() local
2215 if (host->mode != FCGI_AUTHORIZER || in fcgi_response_parse()
2256 …if (host->allow_xsendfile && 0 == strncasecmp(key, "X-Sendfile2", key_len)&& hctx->send_content_bo… in fcgi_response_parse()
2496 fcgi_extension_host *host= hctx->host; in fcgi_demux_response() local
2611 if (host->mode == FCGI_AUTHORIZER && in fcgi_demux_response()
2618 if (host->allow_xsendfile && hctx->send_content_body && in fcgi_demux_response()
2683 if (host->mode != FCGI_AUTHORIZER || in fcgi_demux_response()
2704 static int fcgi_restart_dead_procs(server *srv, plugin_data *p, fcgi_extension_host *host) { in fcgi_restart_dead_procs() argument
2707 for (proc = host->first; proc; proc = proc->next) { in fcgi_restart_dead_procs()
2737 host->active_procs++; in fcgi_restart_dead_procs()
2741 host->host, host->port, in fcgi_restart_dead_procs()
2742 host->unixsocket); in fcgi_restart_dead_procs()
2758 host->active_procs++; in fcgi_restart_dead_procs()
2762 host->host, host->port, in fcgi_restart_dead_procs()
2763 host->unixsocket); in fcgi_restart_dead_procs()
2804 if (!buffer_is_empty(host->bin_path)) { in fcgi_restart_dead_procs()
2815 "\n\tcurrent:", 1, "/", host->max_procs); in fcgi_restart_dead_procs()
2818 if (fcgi_spawn_connection(srv, p, host, proc)) { in fcgi_restart_dead_procs()
2827 host->active_procs++; in fcgi_restart_dead_procs()
2842 fcgi_extension_host *host= hctx->host; in fcgi_write_request() local
2854 if (!host) { in fcgi_write_request()
2858 if ((!host->port && !host->unixsocket->used)) { in fcgi_write_request()
2888 …"backend is overloaded; we'll disable it for", hctx->host->disable_time, "seconds and send the req… in fcgi_write_request()
2890 "load:", host->load); in fcgi_write_request()
2892 fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); in fcgi_write_request()
2912 for (proc = hctx->host->first; in fcgi_write_request()
2931 ret = host->unixsocket->used ? AF_UNIX : AF_INET; in fcgi_write_request()
2975 if (hctx->host->disable_time) { in fcgi_write_request()
2977 …"backend is overloaded; we'll disable it for", hctx->host->disable_time, "seconds and send the req… in fcgi_write_request()
2979 "load:", host->load); in fcgi_write_request()
2981 hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; in fcgi_write_request()
2982 if (hctx->proc->state == PROC_STATE_RUNNING) hctx->host->active_procs--; in fcgi_write_request()
2986 fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); in fcgi_write_request()
3003 …"backend died; we'll disable it for", hctx->host->disable_time, "seconds and send the request to a… in fcgi_write_request()
3005 "load:", host->load); in fcgi_write_request()
3007 fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); in fcgi_write_request()
3029 fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); in fcgi_write_request()
3112 fcgi_extension_host *host; in SUBREQUEST_FUNC() local
3122 if (hctx->host == NULL) { in SUBREQUEST_FUNC()
3129 host = hctx->ext->hosts[ndx]; in SUBREQUEST_FUNC()
3130 if (host->load > 0) { in SUBREQUEST_FUNC()
3133 host = hctx->ext->hosts[k]; in SUBREQUEST_FUNC()
3136 if (host->active_procs == 0) continue; in SUBREQUEST_FUNC()
3138 if (used == -1 || host->load < used) { in SUBREQUEST_FUNC()
3139 used = host->load; in SUBREQUEST_FUNC()
3159 host = hctx->ext->hosts[ndx]; in SUBREQUEST_FUNC()
3171 fcgi_host_assign(srv, hctx, host); in SUBREQUEST_FUNC()
3174 host = hctx->host; in SUBREQUEST_FUNC()
3180 host = hctx->host; in SUBREQUEST_FUNC()
3184 fcgi_restart_dead_procs(srv, p, host); in SUBREQUEST_FUNC()
3232 fcgi_extension_host *host= hctx->host; in fcgi_handle_fdevent() local
3241 if (host->mode == FCGI_AUTHORIZER && in fcgi_handle_fdevent()
3250 buffer_copy_string_buffer(con->physical.doc_root, host->docroot); in fcgi_handle_fdevent()
3251 buffer_copy_string_buffer(con->physical.basedir, host->docroot); in fcgi_handle_fdevent()
3253 buffer_copy_string_buffer(con->physical.path, host->docroot); in fcgi_handle_fdevent()
3299 "\n\tcurrent:", 1, "/", host->max_procs); in fcgi_handle_fdevent()
3302 if (fcgi_spawn_connection(srv, p, host, proc)) { in fcgi_handle_fdevent()
3463 fcgi_extension_host *host = NULL; in fcgi_check_extension() local
3557 host = h; in fcgi_check_extension()
3561 if (!host) { in fcgi_check_extension()
3589 if (host->check_local == 0) { in fcgi_check_extension()
3614 if (host->mode != FCGI_AUTHORIZER) { in fcgi_check_extension()
3643 … if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') { in fcgi_check_extension()
3762 fcgi_extension_host *host; in TRIGGER_FUNC() local
3764 host = ex->hosts[n]; in TRIGGER_FUNC()
3766 fcgi_restart_dead_procs(srv, p, host); in TRIGGER_FUNC()
3768 for (proc = host->unused_procs; proc; proc = proc->next) { in TRIGGER_FUNC()
3813 if (proc->state == PROC_STATE_RUNNING) host->active_procs--; in TRIGGER_FUNC()
3815 host->max_id--; in TRIGGER_FUNC()