31 |
extern int boa_ssl; |
extern int boa_ssl; |
32 |
int system_bufsize = 0; /* Default size of SNDBUF given by system */ |
int system_bufsize = 0; /* Default size of SNDBUF given by system */ |
33 |
|
|
34 |
|
inline |
35 |
|
static void init_vhost_stuff( request* req, char* value); |
36 |
|
|
37 |
/* function prototypes located in this file only */ |
/* function prototypes located in this file only */ |
38 |
static void free_request( server_params* params, request ** list_head_addr, |
static void free_request( server_params* params, request ** list_head_addr, |
39 |
request * req); |
request * req); |
239 |
|
|
240 |
ascii_sockaddr(&salocal, conn->local_ip_addr, NI_MAXHOST); |
ascii_sockaddr(&salocal, conn->local_ip_addr, NI_MAXHOST); |
241 |
|
|
|
if (default_document_root) |
|
|
memcpy( conn->document_root, default_document_root, default_document_root_size + 1); |
|
|
|
|
242 |
/* nonblocking socket */ |
/* nonblocking socket */ |
243 |
if (set_nonblock_fd(conn->fd) == -1) |
if (set_nonblock_fd(conn->fd) == -1) |
244 |
WARN("fcntl: unable to set new socket to non-block"); |
WARN("fcntl: unable to set new socket to non-block"); |
272 |
#endif |
#endif |
273 |
} |
} |
274 |
} |
} |
275 |
|
|
276 |
|
init_vhost_stuff(conn, ""); |
277 |
|
|
278 |
/* for log file and possible use by CGI programs */ |
/* for log file and possible use by CGI programs */ |
279 |
ascii_sockaddr(&remote_addr, conn->remote_ip_addr, NI_MAXHOST); |
ascii_sockaddr(&remote_addr, conn->remote_ip_addr, NI_MAXHOST); |
874 |
|
|
875 |
vhost = find_virthost( value, valuelen); |
vhost = find_virthost( value, valuelen); |
876 |
|
|
877 |
|
if (vhost == NULL && value[0]!=0) { |
878 |
|
value = ""; |
879 |
|
vhost = find_virthost( "", 0); |
880 |
|
} |
881 |
|
|
882 |
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) )) |
883 |
{ |
{ |
884 |
req->hostname = value; |
req->hostname = value; |
886 |
if (vhost->user_dir) |
if (vhost->user_dir) |
887 |
memcpy( req->user_dir, vhost->user_dir, vhost->user_dir_len + 1); |
memcpy( req->user_dir, vhost->user_dir, vhost->user_dir_len + 1); |
888 |
|
|
|
} else { /* No virtual host found. use defaults */ |
|
|
if ( default_document_root) |
|
|
memcpy( req->document_root, default_document_root, default_document_root_size + 1); |
|
889 |
} |
} |
890 |
|
|
891 |
} |
} |