Commit 2502baf2 authored by Ryan Bloom's avatar Ryan Bloom
Browse files

Backout layered I/O changes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84842 13f79535-47bb-0310-9956-ffa450edef68
parent 6c31a570
Loading
Loading
Loading
Loading
+1 −1
Changes for docs/manual/developer/index.html: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -14,6 +14,6 @@
<h2 align="center">Developer Documentation for Apache-2.0</h2>
<p><a href="hooks.html">Apache Hook Functions</a></p>
<p><a href="modules.html">Converting Apache 1.3 Modules to Apache 2.0</a></p>
<p><a href="layeredio.html">Taking advantage of layered I/O in Apache 2.0</a></p>
<p><a href="../user/mpm.html">MPM listing</a></p>
</body>
</html>
+1 −11
Changes for include/httpd.h: 1 added line, 11 removed lines.
Original line number Diff line number Diff line
@@ -391,10 +391,7 @@ API_EXPORT(const char *) ap_get_server_built(void);
				 *  - it's safe to die() with no more output
				 */
#define OK 0			/* Module has handled this stage. */
#define RERUN_HANDLERS 1        /* Module has handled this request, but
                                 * realizes others may also want to handle
                                 * it.
                                 */


/* ----------------------- HTTP Status Codes  ------------------------- */

@@ -583,13 +580,6 @@ struct request_rec {
    conn_rec *connection;
    server_rec *server;

    BUFF *input;                /* Where to get the data (usually a pipe
                                 * or a file currently). 
                                 */
    BUFF *output;               /* Where to send the data (usually, a pipe
                                 * or the socket currently).
                                 */

    request_rec *next;		/* If we wind up getting redirected,
				 * pointer to the request we redirected to.
				 */
+8 −53
Changes for modules/filters/mod_include.c: 8 added lines, 53 removed lines.
Original line number Diff line number Diff line
@@ -2364,30 +2364,20 @@ static const char *set_xbithack(cmd_parms *cmd, void *xbp, char *arg)
    return NULL;
}

struct {
    ap_thread_t *thread;
    request_rec *r;
} ssi_rec;

void * API_THREAD_FUNC sub_send_parsed_file(void *rec)
static int send_parsed_file(request_rec *r)
{
    ap_file_t *f = NULL;
    struct ssi_rec *dumb_rec = (struct ssi_rec *)rec;
    ap_thread_t *subthread = dumb_rec->thread
    request_rec *r = dumb_rec->r;
    enum xbithack *state =
    (enum xbithack *) ap_get_module_config(r->per_dir_config, &includes_module);
    int errstatus;
    request_rec *parent;

    if (!(ap_allow_options(r) & OPT_INCLUDES)) {
        ap_thread_exit(0);
/*        return DECLINED;*/
        return DECLINED;
    }
    r->allowed |= (1 << M_GET);
    if (r->method_number != M_GET) {
        ap_thread_exit(0);
/*        return DECLINED;*/
        return DECLINED;
    }
    if (r->finfo.protection == 0) {
        ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
@@ -2395,8 +2385,7 @@ void * API_THREAD_FUNC sub_send_parsed_file(void *rec)
                    (r->path_info
                     ? ap_pstrcat(r->pool, r->filename, r->path_info, NULL)
                     : r->filename));
        ap_thread_exit(0);
/*        return HTTP_NOT_FOUND;*/
        return HTTP_NOT_FOUND;
    }

    errstatus = ap_open(&f, r->filename, APR_READ, 0, r->pool);
@@ -2404,8 +2393,7 @@ void * API_THREAD_FUNC sub_send_parsed_file(void *rec)
    if (errstatus != APR_SUCCESS) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, errstatus, r,
                    "file permissions deny server access: %s", r->filename);
        ap_thread_exit(0);
/*        return HTTP_FORBIDDEN;*/
        return HTTP_FORBIDDEN;
    }

    if ((*state == xbithack_full)
@@ -2418,16 +2406,14 @@ void * API_THREAD_FUNC sub_send_parsed_file(void *rec)
        ap_set_last_modified(r);
    }
    if ((errstatus = ap_meets_conditions(r)) != OK) {
        ap_thread_exit(0);
/*        return errstatus;*/
        return errstatus;
    }

    ap_send_http_header(r);

    if (r->header_only) {
        ap_close(f);
        ap_thread_exit(0);
/*        return OK;*/
        return OK;
    }

    if ((parent = ap_get_module_config(r->request_config, &includes_module))) {
@@ -2467,39 +2453,8 @@ void * API_THREAD_FUNC sub_send_parsed_file(void *rec)
	ap_set_module_config(r->request_config, &includes_module,
	    NESTED_INCLUDE_MAGIC);
    }
    ap_thread_exit(0);
/*    return OK;*/
}

int send_parsed_file(request_rec *r)
{
    struct ssi_rec dumb_rec;
    ap_thread_t *subthread = NULL;
    ap_file_t *pipein = NULL;
    ap_file_t *pipeout = NULL;
    ap_iol *iolin;
    ap_iol *iolout;
    BUFF *bpipeint = NULL;
    BUFF *bpipeout = NULL;

    ap_create_pipe(&pipein, &pipeout, r->pool);

    iolin = ap_create_file_iol(pipein);
    ap_bpush_iol(bpipein, iolin);

    iolout = ap_create_file_iol(pipeout);
    ap_bpush_iol(bpipeout, iolout);
    r->output = bpipeout;

    ap_setup_input(r);

    dumb_rec->thread = subthread;
    dumb_rec->r = r;
    ap_create_thread(&subthread, NULL, sub_send_parsed_file, dumb_rec, r->pool);
    r->input = bpipein;
        

    return RERUN_HANDLERS;
    return OK;
}

static int send_shtml_file(request_rec *r)
+7 −11
Changes for modules/generators/mod_cgi.c: 7 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -621,9 +621,7 @@ static int cgi_handler(request_rec *r)
	    ap_table_unset(r->headers_in, "Content-Length");

	    ap_internal_redirect_handler(location, r);
/*            r->content_type = NULL;*/
            r->handler = NULL;
	    return RERUN_HANDLERS;
	    return OK;
	}
	else if (location && r->status == 200) {
	    /* XX Note that if a script wants to produce its own Redirect
@@ -632,12 +630,12 @@ static int cgi_handler(request_rec *r)
	    return REDIRECT;
	}

/*	ap_send_http_header(r);*/
	ap_send_http_header(r);
	if (!r->header_only) {
            r->input = script_in;
	    ap_send_fb(script_in, r);
	}
/*	ap_bclose(script_in);
*/
	ap_bclose(script_in);

	while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
	    continue;
	}
@@ -645,12 +643,10 @@ static int cgi_handler(request_rec *r)
    }

    if (script_in && nph) {
        r->input = script_in;
	ap_send_fb(script_in, r);
    }

/*    r->content_type = NULL;*/
    r->handler = NULL;
    return RERUN_HANDLERS;	/* NOT r->status, even if it has changed. */
    return OK;			/* NOT r->status, even if it has changed. */
}

static const handler_rec cgi_handlers[] =
+4 −6
Changes for modules/http/http_core.c: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -2530,15 +2530,12 @@ static int default_handler(request_rec *r)
    if (r->method_number != M_GET) {
        return METHOD_NOT_ALLOWED;
    }
/*	
	
    if ((status = ap_open(&fd, r->filename, APR_READ | APR_BINARY, 0, r->pool)) != APR_SUCCESS) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
		     "file permissions deny server access: %s", r->filename);
        return FORBIDDEN;
    }*/

    ap_setup_input(r);

    }
    ap_update_mtime(r, r->finfo.mtime);
    ap_set_last_modified(r);
    ap_set_etag(r);
@@ -2586,7 +2583,7 @@ static int default_handler(request_rec *r)
	
	if (!r->header_only) {
	    if (!rangestatus) {
		ap_send_fb(r->input, r);
		ap_send_fd(fd, r);
	    }
	    else {
		long     length;
@@ -2637,6 +2634,7 @@ static int default_handler(request_rec *r)
    }
#endif

    ap_close(fd);
    return OK;
}

Loading