unix/posix notes:
- The MPM does not set a SIGALRM handler, user code may use SIGALRM.
But the preferred method of handling timeouts is to use the
- timeouts provided by the BUFF/iol abstraction.
+ timeouts provided by the BUFF abstraction.
- The proper setting for SIGPIPE is SIG_IGN, if user code changes it
for any of their own processing, it must be restored to SIG_IGN
prior to executing or returning to any apache code.
apr_table_t *env = r->subprocess_env;
char **argv;
apr_file_t *file = NULL;
- ap_iol *iol;
+ apr_socket_t *sock = NULL;
#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \
defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS)
core_dir_config *conf;
apr_note_subprocess(r->pool, procnew, kill_after_timeout);
/* Fill in BUFF structure for parents pipe to child's stdout */
file = procnew->out;
- iol = ap_create_file_iol(file);
- if (!iol)
+ if (!file)
return APR_EBADF;
+ /* XXX This is a hack. The correct solution is to create a
+ * pipe bucket, and just pass it down. Since that bucket type
+ * hasn't been written, we can hack it for the moment.
+ */
+ apr_socket_from_file(&sock, file);
script_in = ap_bcreate(r->pool, B_RD);
- ap_bpush_iol(script_in, iol);
+ ap_bpush_socket(script_in, sock);
ap_send_fb(script_in, r);
ap_bclose(script_in);
}
apr_proc_t *procnew = apr_pcalloc(p, sizeof(*procnew));
apr_status_t rc = APR_SUCCESS;
apr_file_t *file = NULL;
- ap_iol *iol;
+ apr_file_t *sock = NULL;
#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \
defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS)
core_dir_config *conf;
/* Fill in BUFF structure for parents pipe to child's stdout */
file = procnew->out;
- iol = ap_create_file_iol(file);
- if (!iol)
+ if (!file)
return APR_EBADF;
+ /* XXX This is a hack. The correct solution is to create a
+ * pipe bucket, and just pass it down. Since that bucket type
+ * hasn't been written, we can hack it for the moment.
+ */
+ apr_socket_from_file(&sock, file);
+
*script_in = ap_bcreate(p, B_RD);
- ap_bpush_iol(*script_in, iol);
+ ap_bpush_socket(*script_in, sock);
ap_bsetopt(*script_in, BO_TIMEOUT, &r->server->timeout);
/* Fill in BUFF structure for parents pipe to child's stdin */
file = procnew->in;
- iol = ap_create_file_iol(file);
- if (!iol)
+ if (!file)
return APR_EBADF;
+ /* XXX This is a hack. The correct solution is to create a
+ * pipe bucket, and just pass it down. Since that bucket type
+ * hasn't been written, we can hack it for the moment.
+ */
+ apr_socket_from_file(&sock, file);
*script_out = ap_bcreate(p, B_WR);
- ap_bpush_iol(*script_out, iol);
+ ap_bpush_socket(*script_out, sock);
ap_bsetopt(*script_out, BO_TIMEOUT, &r->server->timeout);
/* Fill in BUFF structure for parents pipe to child's stderr */
file = procnew->err;
- iol = ap_create_file_iol(file);
- if (!iol)
+ if (!file)
return APR_EBADF;
+ /* XXX This is a hack. The correct solution is to create a
+ * pipe bucket, and just pass it down. Since that bucket type
+ * hasn't been written, we can hack it for the moment.
+ */
+ apr_socket_from_file(&sock, file);
*script_err = ap_bcreate(p, B_RD);
- ap_bpush_iol(*script_err, iol);
+ ap_bpush_socket(*script_err, sock);
ap_bsetopt(*script_err, BO_TIMEOUT, &r->server->timeout);
}
}
#include "http_conf_globals.h"
#include "buff.h"
#include "ap_mpm.h"
-#include "ap_iol.h"
#include "unixd.h"
#include <sys/stat.h>
#ifdef HAVE_SYS_SOCKET_H
struct sockaddr_un unix_addr;
apr_socket_t *tempsock = NULL;
int nbytes;
- ap_iol *iol;
script = ap_bcreate(r->pool, B_RDWR);
if (r->method_number == M_OPTIONS) {
apr_put_os_sock(&tempsock, &sd, pcgi);
- iol = ap_iol_attach_socket(pcgi, tempsock);
-
- ap_bpush_iol(script, iol);
+ ap_bpush_socket(script, tempsock);
if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
return retval;
/* Default filter. This filter should almost always be used. It's only job
* is to send the headers if they haven't already been sent, and then send
* the actual data. To send the data, we create an iovec out of the bucket
- * brigade and then call the iol's writev function. On platforms that don't
+ * brigade and then call the sendv function. On platforms that don't
* have writev, we have the problem of creating a lot of potentially small
* packets that we are sending to the network.
*
/*
* We want to send any data held in the client buffer on the
- * call to iol_sendfile. So hijack it then set outcnt to 0
+ * call to apr_sendfile. So hijack it then set outcnt to 0
* to prevent the data from being sent to the client again
* when the buffer is flushed to the client at the end of the
* request.
flags |= APR_SENDFILE_DISCONNECT_SOCKET;
}
- rv = iol_sendfile(r->connection->client->iol,
+ rv = apr_sendfile(r->connection->client->bsock,
fd, /* The file to send */
&hdtr, /* Header and trailer iovecs */
&offset, /* Offset in file to begin sending from */
apr_pool_t *child_context = cntxt;
apr_procattr_t *procattr;
apr_proc_t *procnew;
- ap_iol *iol;
+ apr_socket_t *sock;
env = ap_create_environment(child_context, r->subprocess_env);
else {
apr_note_subprocess(child_context, procnew, kill_after_timeout);
/* Fill in BUFF structure for parents pipe to child's stdout */
- iol = ap_create_file_iol(procnew->out);
- if (!iol)
- return APR_EBADF;
+ /* XXX This is a hack. The correct solution is to create a
+ * pipe bucket, and just pass it down. Since that bucket type
+ * hasn't been written, we can hack it for the moment.
+ */
+ apr_socket_from_file(&sock, procnew->out);
+
if (script_in) {
*script_in = ap_bcreate(child_context, B_RD);
}
- ap_bpush_iol(*script_in, iol);
+ ap_bpush_socket(*script_in, sock);
}
}
#include "mod_proxy.h"
#include "http_log.h"
#include "http_main.h"
-#include "ap_iol.h"
#ifdef HAVE_BSTRING_H
#include <bstring.h> /* for IRIX, FD_SET calls bzero() */
}
sock_buff = ap_bcreate(r->pool, B_RDWR);
- ap_bpush_iol(sock_buff, ap_iol_attach_socket(sock));
+ ap_bpush_socket(sock_buff, sock);
if(apr_setup_poll(&pollfd, 2, r->pool) != APR_SUCCESS)
{
#include "http_main.h"
#include "http_log.h"
#include "http_core.h"
-#include "ap_iol.h"
#define AUTODETECT_PWD
}
f = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(f, ap_iol_attach_socket(sock));
+ ap_bpush_socket(f, sock);
/* shouldn't we implement telnet control options here? */
#ifdef CHARSET_EBCDIC
}
}
data = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(f, ap_iol_attach_socket(csd));
+ ap_bpush_socket(f, csd);
}
else {
data = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(data, ap_iol_attach_socket(dsock));
+ ap_bpush_socket(data, dsock);
}
/* send response */
#include "http_main.h"
#include "http_core.h"
#include "util_date.h"
-#include "ap_iol.h"
/*
* Canonicalise http-like URLs.
clear_connection(r->pool, r->headers_in); /* Strip connection-based headers */
f = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(f, ap_iol_attach_socket(sock));
+ ap_bpush_socket(f, sock);
ap_bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.0" CRLF,
NULL);
buff.c http_config.c http_core.c http_log.c http_main.c \
http_protocol.c http_request.c http_vhost.c util.c util_date.c \
util_script.c util_uri.c util_md5.c util_cfgtree.c util_ebcdic.c \
- rfc1413.c http_connection.c iol_file.c iol_socket.c listen.c \
+ rfc1413.c http_connection.c listen.c \
mpm_common.c util_charset.c util_debug.c util_xml.c \
util_filter.c
#include "http_connection.h"
#include "ap_mpm.h"
#include "beosd.h"
-#include "ap_iol.h"
#include "ap_listen.h"
#include "scoreboard.h"
#include <kernel/OS.h>
{
BUFF *conn_io;
conn_rec *current_conn;
- ap_iol *iol;
long conn_id = my_child_num;
int csd;
return;
}
- iol = ap_iol_attach_socket(p, sock);
- if (iol == NULL) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL,
- "error attaching to socket");
- apr_close_socket(sock);
- return;
- }
-
conn_io = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(conn_io, iol);
+ ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
conn_id);
#include "ap_mpm.h"
#include "unixd.h"
#include "mpm_common.h"
-#include "ap_iol.h"
#include "ap_listen.h"
#include "mpm_default.h"
#include "mpm.h"
{
BUFF *conn_io;
conn_rec *current_conn;
- ap_iol *iol;
int csd;
apr_status_t rv;
}
ap_sock_disable_nagle(sock);
- iol = ap_iol_attach_socket(p, sock);
+
conn_io = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(conn_io, iol);
+ ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
conn_id);
#include "ap_mpm.h"
#include "unixd.h"
#include "mpm_common.h"
-#include "ap_iol.h"
#include "ap_listen.h"
#include "mpm_default.h"
#include "mpm.h"
{
BUFF *conn_io;
conn_rec *current_conn;
- ap_iol *iol;
int csd;
apr_status_t rv;
int thread_num = conn_id % HARD_THREAD_LIMIT;
if (thread_socket_table[thread_num] < 0) {
ap_sock_disable_nagle(sock);
}
- iol = ap_iol_attach_socket(p, sock);
conn_io = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(conn_io, iol);
+ ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
conn_id);
static int pass_request(request_rec *r)
{
- apr_socket_t *thesock = ap_iol_get_socket(r->connection->client->iol);
+ apr_socket_t *thesock = r->connection->client->bsock;
struct msghdr msg;
struct cmsghdr *cmsg;
int sfd;
if (thread_socket_table[thread_num] != -1) {
apr_socket_t *csd = NULL;
- ap_iol *iol;
apr_put_os_sock(&csd, &thread_socket_table[thread_num],
r->connection->client->pool);
ap_sock_disable_nagle(thread_socket_table[thread_num]);
- iol = ap_iol_attach_socket(r->connection->client->pool, csd);
- ap_bpush_iol(r->connection->client, iol);
+ ap_bpush_socket(r->connection->client, csd);
return OK;
}
else {
#include "http_connection.h"
#include "ap_mpm.h"
#include "beosd.h"
-#include "ap_iol.h"
#include "ap_listen.h"
#include "scoreboard.h"
#include "poll.h"
{
BUFF *conn_io;
conn_rec *current_conn;
- ap_iol *iol;
long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
int csd;
- iol = ap_iol_attach_socket(p, sock);
- if (iol == NULL) {
- if (errno == EBADF) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, NULL,
- "filedescriptor (%u) larger than FD_SETSIZE (%u) "
- "found, you probably need to rebuild Apache with a "
- "larger FD_SETSIZE", csd, FD_SETSIZE);
- }
- else {
- ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL,
- "error attaching to socket");
- }
- apr_close_socket(sock);
- return;
- }
-
conn_io = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(conn_io, iol);
+ ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
conn_id);
#include "ap_mpm.h"
#include "unixd.h"
#include "mpm_common.h"
-#include "ap_iol.h"
#include "ap_listen.h"
#include "scoreboard.h"
{
BUFF *conn_io;
conn_rec *current_conn;
- ap_iol *iol;
long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
int csd;
ap_sock_disable_nagle(sock);
- iol = ap_iol_attach_socket(p, sock);
-
(void) ap_update_child_status(my_child_num, my_thread_num,
SERVER_BUSY_READ, (request_rec *) NULL);
conn_io = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(conn_io, iol);
+ ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
conn_id);
#include "ap_mpm.h"
#include "unixd.h"
#include "mpm_common.h"
-#include "ap_iol.h"
#include "ap_listen.h"
#include "mpm_default.h"
#include "mpm.h"
{
BUFF *conn_io;
conn_rec *current_conn;
- ap_iol *iol;
int csd;
apr_status_t rv;
int thread_num = conn_id % HARD_THREAD_LIMIT;
if (thread_socket_table[thread_num] < 0) {
ap_sock_disable_nagle(sock);
}
- iol = ap_iol_attach_socket(p, sock);
conn_io = ap_bcreate(p, B_RDWR);
- ap_bpush_iol(conn_io, iol);
+ ap_bpush_socket(conn_io, sock);
current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
conn_id);
static int pass_request(request_rec *r)
{
- apr_socket_t *thesock = ap_iol_get_socket(r->connection->client->iol);
+ apr_socket_t *thesock = r->connection->client->bsock;
struct msghdr msg;
struct cmsghdr *cmsg;
int sfd;
if (thread_socket_table[thread_num] != -1) {
apr_socket_t *csd = NULL;
- ap_iol *iol;
apr_put_os_sock(&csd, &thread_socket_table[thread_num],
r->connection->client->pool);
ap_sock_disable_nagle(thread_socket_table[thread_num]);
- iol = ap_iol_attach_socket(r->connection->client->pool, csd);
- ap_bpush_iol(r->connection->client, iol);
+ ap_bpush_socket(r->connection->client, csd);
return OK;
}
else {
#include "ap_mpm.h"
#include "unixd.h"
#include "mpm_common.h"
-#include "ap_iol.h"
#include "ap_listen.h"
#include "ap_mmn.h"
#ifdef HAVE_SYS_TYPES_H
ap_listen_rec *first_lr;
apr_pool_t *ptrans;
conn_rec *current_conn;
- ap_iol *iol;
apr_status_t stat = APR_EINIT;
int sockdes;
ap_sock_disable_nagle(csd);
- iol = ap_iol_attach_socket(ptrans, csd);
(void) ap_update_child_status(my_child_num, SERVER_BUSY_READ,
(request_rec *) NULL);
conn_io = ap_bcreate(ptrans, B_RDWR);
- ap_bpush_iol(conn_io, iol);
+ ap_bpush_socket(conn_io, csd);
current_conn = ap_new_apr_connection(ptrans, ap_server_conf, conn_io, csd,
my_child_num);
#include "scoreboard.h"
#include "ap_mpm.h"
#include "ap_listen.h"
-#include "ap_iol.h"
#include "apr_portable.h"
#include "mpm_common.h"
#include "apr_strings.h"
ap_listen_rec *first_lr = NULL;
apr_pool_t *ptrans;
conn_rec *current_conn;
- ap_iol *iol;
apr_pool_t *pchild;
parent_score *sc_parent_rec;
int requests_this_child = 0;
ap_sock_disable_nagle(csd);
- iol = ap_iol_attach_socket(ptrans, csd);
-
- if (iol == NULL) {
- ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, NULL,
- "error attaching to socket");
- apr_close_socket(csd);
- continue;
- }
-
(void) ap_update_child_status(THREAD_GLOBAL(child_num), SERVER_BUSY_READ,
(request_rec *) NULL);
conn_io = ap_bcreate(ptrans, B_RDWR);
- ap_bpush_iol(conn_io, iol);
+ ap_bpush_socket(conn_io, csd);
current_conn = ap_new_apr_connection(ptrans, ap_server_conf, conn_io, csd,
THREAD_GLOBAL(child_num));
#include "ap_config.h"
#include "ap_listen.h"
#include "mpm_default.h"
-#include "ap_iol.h"
#include "mpm_winnt.h"
#include "mpm_common.h"
while (1) {
conn_rec *c;
- ap_iol *iol;
apr_int32_t disconnected;
/* Grab a connection off the network */
sock_disable_nagle(context->accept_socket);
apr_put_os_sock(&context->sock, &context->accept_socket, context->ptrans);
- iol = ap_iol_attach_socket(context->ptrans, context->sock);
- if (iol == NULL) {
- ap_log_error(APLOG_MARK, APLOG_ERR, APR_ENOMEM, server_conf,
- "worker_main: attach_socket() failed. Continuing...");
- closesocket(context->accept_socket);
- continue;
- }
- ap_bpush_iol(context->conn_io, iol);
+ ap_bpush_socket(context->conn_io, context->sock);
c = ap_new_connection(context->ptrans, server_conf, context->conn_io,
(struct sockaddr_in *) context->sa_client,
(struct sockaddr_in *) context->sa_server,
apr_getsocketopt(context->sock, APR_SO_DISCONNECTED, &disconnected);
if (disconnected) {
+ /* I have no idea if we should do anything here, so I leave this
+ * for a windows guy
+ */
/* Kill the clean-up registered by the iol. We want to leave
* the accept socket open because we are about to try to
* reuse it
*/
- ap_bpop_iol(&iol, context->conn_io);
}
else {
context->accept_socket = INVALID_SOCKET;