101 |
*/ |
*/ |
102 |
pthread_mutex_lock( &accept_mutex[ server_s->secure]); |
pthread_mutex_lock( &accept_mutex[ server_s->secure]); |
103 |
#endif |
#endif |
|
|
|
104 |
fd = accept(server_s->socket, (struct sockaddr *) &remote_addr, |
fd = accept(server_s->socket, (struct sockaddr *) &remote_addr, |
105 |
&remote_addrlen); |
&remote_addrlen); |
106 |
|
|
107 |
#ifdef ENABLE_SMP |
#ifdef ENABLE_SMP |
108 |
|
/* No dead lock conditions here, since accept() is non blocking. |
109 |
|
*/ |
110 |
pthread_mutex_unlock( &accept_mutex[ server_s->secure]); |
pthread_mutex_unlock( &accept_mutex[ server_s->secure]); |
111 |
#endif |
#endif |
112 |
|
|
200 |
conn->kacount = ka_max; |
conn->kacount = ka_max; |
201 |
|
|
202 |
ascii_sockaddr(&salocal, conn->local_ip_addr, NI_MAXHOST); |
ascii_sockaddr(&salocal, conn->local_ip_addr, NI_MAXHOST); |
203 |
conn->document_root = strdup( default_document_root); |
|
204 |
|
if (default_document_root) |
205 |
|
memcpy( conn->document_root, default_document_root, default_document_root_size + 1); |
206 |
|
|
207 |
/* nonblocking socket */ |
/* nonblocking socket */ |
208 |
if (set_nonblock_fd(conn->fd) == -1) |
if (set_nonblock_fd(conn->fd) == -1) |
332 |
if (req->script_name) |
if (req->script_name) |
333 |
free(req->script_name); |
free(req->script_name); |
334 |
|
|
|
if (req->document_root) |
|
|
free(req->document_root); |
|
|
if (req->user_dir) |
|
|
free(req->user_dir); |
|
|
|
|
335 |
if ((req->keepalive == KA_ACTIVE) && |
if ((req->keepalive == KA_ACTIVE) && |
336 |
(req->response_status < 500) && req->kacount > 0) { |
(req->response_status < 500) && req->kacount > 0) { |
337 |
int bytes_to_move; |
int bytes_to_move; |
860 |
|
|
861 |
if ( vhost && ( vhost->ip == NULL || !memcmp( vhost->ip, req->local_ip_addr, vhost->ip_len) )) |
if ( vhost && ( vhost->ip == NULL || !memcmp( vhost->ip, req->local_ip_addr, vhost->ip_len) )) |
862 |
{ |
{ |
863 |
if (req->document_root) free( req->document_root); |
memcpy( req->document_root, vhost->document_root, vhost->document_root_len + 1); |
864 |
req->document_root = strdup( vhost->document_root); |
if (vhost->user_dir) |
865 |
|
memcpy( req->user_dir, vhost->user_dir, vhost->user_dir_len + 1); |
866 |
if (req->user_dir) |
|
|
req->user_dir = strdup( vhost->user_dir); |
|
|
else req->user_dir = NULL; |
|
867 |
} else { /* No virtual host found. use defaults */ |
} else { /* No virtual host found. use defaults */ |
868 |
if ( default_document_root) |
if ( default_document_root) |
869 |
req->document_root = strdup( default_document_root); |
memcpy( req->document_root, default_document_root, default_document_root_size + 1); |
|
else req->document_root = NULL; |
|
|
|
|
|
req->user_dir = NULL; |
|
870 |
} |
} |
871 |
} else { |
} else { |
872 |
if (!add_cgi_env(req, line, value, 1)) |
if (!add_cgi_env(req, line, value, 1)) |