74 |
static void destroy_host_allow(HostsAllow); |
static void destroy_host_allow(HostsAllow); |
75 |
|
|
76 |
/** |
/** |
77 |
* A http 1.0 server. The server delegates handling of a HTTP request |
* A naive http 1.0 server. The server delegates handling of a HTTP |
78 |
* and response to the processor module. |
* request and response to the processor module. |
79 |
* |
* |
80 |
* NOTE |
* NOTE |
81 |
* This server does not use threads or forks; Requests are |
* This server does not use threads or forks; Requests are |
426 |
|
|
427 |
again: |
again: |
428 |
errno= 0; |
errno= 0; |
429 |
if ( (client= accept(server, (struct sockaddr*)&in, &len)) < 0) { |
if((client= accept(server, (struct sockaddr*)&in, &len)) < 0) { |
430 |
|
|
431 |
if ( stopped ) { |
if(stopped) { |
|
|
|
432 |
log("http server: service stopped\n"); |
log("http server: service stopped\n"); |
433 |
|
} else if(errno == EINTR) { |
|
} else if ( errno == EINTR ) { |
|
|
|
|
434 |
goto again; |
goto again; |
|
|
|
435 |
} else { |
} else { |
|
|
|
436 |
log("http server: cannot accept connection -- %s\n", STRERROR); |
log("http server: cannot accept connection -- %s\n", STRERROR); |
|
|
|
437 |
} |
} |
438 |
|
|
439 |
return NULL; |
return NULL; |
440 |
|
|
441 |
} |
} |
442 |
|
|
443 |
|
if(set_noblock(client) < 0) { |
444 |
|
close_socket(client); |
445 |
|
return NULL; |
446 |
|
} |
447 |
|
|
448 |
return create_wrapper(in.sin_addr, client); |
return create_wrapper(in.sin_addr, client); |
449 |
|
|
450 |
} |
} |