~ubuntu-branches/ubuntu/hardy/apache2/hardy-proposed

« back to all changes in this revision

Viewing changes to modules/ssl/ssl_engine_io.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Fritsch
  • Date: 2008-01-17 20:27:56 UTC
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20080117202756-hv38rjknhwa2ilwi
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1541
1541
 
1542
1542
    apr_brigade_destroy(tempb);
1543
1543
 
1544
 
    /* Insert the filter which will supply the buffered data. */
 
1544
    /* After consuming all protocol-level input, remove all protocol-level
 
1545
     * filters.  It should strictly only be necessary to remove filters
 
1546
     * at exactly ftype == AP_FTYPE_PROTOCOL, since this filter will 
 
1547
     * precede all > AP_FTYPE_PROTOCOL anyway. */
 
1548
    while (r->proto_input_filters->frec->ftype < AP_FTYPE_CONNECTION) {
 
1549
        ap_remove_input_filter(r->proto_input_filters);
 
1550
    }
 
1551
 
 
1552
    /* Insert the filter which will supply the buffered content. */
1545
1553
    ap_add_input_filter(ssl_io_buffer, ctx, r, c);
1546
1554
 
1547
1555
    return 0;
1548
1556
}
1549
1557
 
1550
1558
/* This input filter supplies the buffered request body to the caller
1551
 
 * from the brigade stored in f->ctx. */
 
1559
 * from the brigade stored in f->ctx.  Note that the placement of this
 
1560
 * filter in the filter stack is important; it must be the first
 
1561
 * r->proto_input_filter; lower-typed filters will not be preserved
 
1562
 * across internal redirects (see PR 43738).  */
1552
1563
static apr_status_t ssl_io_filter_buffer(ap_filter_t *f,
1553
1564
                                         apr_bucket_brigade *bb,
1554
1565
                                         ap_input_mode_t mode,
1567
1578
        return APR_ENOTIMPL;
1568
1579
    }
1569
1580
 
 
1581
    if (APR_BRIGADE_EMPTY(ctx->bb)) {
 
1582
        /* Suprisingly (and perhaps, wrongly), the request body can be
 
1583
         * pulled from the input filter stack more than once; a
 
1584
         * handler may read it, and ap_discard_request_body() will
 
1585
         * attempt to do so again after *every* request.  So input
 
1586
         * filters must be prepared to give up an EOS if invoked after
 
1587
         * initially reading the request. The HTTP_IN filter does this
 
1588
         * with its ->eos_sent flag. */
 
1589
 
 
1590
        APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_eos_create(f->c->bucket_alloc));
 
1591
        return APR_SUCCESS;
 
1592
    }
 
1593
 
1570
1594
    if (mode == AP_MODE_READBYTES) {
1571
1595
        apr_bucket *e;
1572
1596
 
1621
1645
        }
1622
1646
 
1623
1647
        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, f->c,
1624
 
                      "buffered SSL brigade now exhausted; removing filter");
1625
 
        ap_remove_input_filter(f);
 
1648
                      "buffered SSL brigade exhausted");
 
1649
        /* Note that the filter must *not* be removed here; it may be
 
1650
         * invoked again, see comment above. */
1626
1651
    }
1627
1652
 
1628
1653
    return APR_SUCCESS;
1665
1690
    filter_ctx->pbioWrite       = BIO_new(&bio_filter_out_method);
1666
1691
    filter_ctx->pbioWrite->ptr  = (void *)bio_filter_out_ctx_new(filter_ctx, c);
1667
1692
 
 
1693
    /* We insert a clogging input filter. Let the core know. */
 
1694
    c->clogging_input_filters = 1;
 
1695
    
1668
1696
    ssl_io_input_add_filter(filter_ctx, c, ssl);
1669
1697
 
1670
1698
    SSL_set_bio(ssl, filter_ctx->pbioRead, filter_ctx->pbioWrite);
1691
1719
    ap_register_input_filter  (ssl_io_filter, ssl_io_filter_input,  NULL, AP_FTYPE_CONNECTION + 5);
1692
1720
    ap_register_output_filter (ssl_io_filter, ssl_io_filter_output, NULL, AP_FTYPE_CONNECTION + 5);
1693
1721
 
1694
 
    ap_register_input_filter  (ssl_io_buffer, ssl_io_filter_buffer, NULL, AP_FTYPE_PROTOCOL - 1);
 
1722
    ap_register_input_filter  (ssl_io_buffer, ssl_io_filter_buffer, NULL, AP_FTYPE_PROTOCOL);
1695
1723
 
1696
1724
    return;
1697
1725
}