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

« back to all changes in this revision

Viewing changes to server/protocol.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:
1399
1399
         * can simply insert our buffered data at the front and
1400
1400
         * pass the whole bundle down the chain.
1401
1401
         */
1402
 
        APR_BRIGADE_CONCAT(ctx->bb, bb);
1403
 
        bb = ctx->bb;
1404
 
        ctx->bb = NULL;
 
1402
        APR_BRIGADE_PREPEND(bb, ctx->bb);
1405
1403
    }
1406
1404
 
1407
1405
    return ap_pass_brigade(f->next, bb);
1539
1537
 
1540
1538
    written = apr_vformatter(r_flush, &vd.vbuff, fmt, va);
1541
1539
 
1542
 
    /* tack on null terminator on remaining string */
1543
 
    *(vd.vbuff.curpos) = '\0';
1544
 
 
1545
1540
    if (written != -1) {
1546
1541
        int n = vd.vbuff.curpos - vrprintf_buf;
1547
1542
 
1633
1628
    }
1634
1629
}
1635
1630
 
 
1631
typedef struct hdr_ptr {
 
1632
    ap_filter_t *f;
 
1633
    apr_bucket_brigade *bb;
 
1634
} hdr_ptr;
 
1635
 
 
1636
static int send_header(void *data, const char *key, const char *val)
 
1637
{
 
1638
    ap_fputstrs(((hdr_ptr*)data)->f, ((hdr_ptr*)data)->bb,
 
1639
                key, ": ", val, CRLF, NULL);
 
1640
    return 1;
 
1641
}
 
1642
 
 
1643
AP_DECLARE(void) ap_send_interim_response(request_rec *r, int send_headers)
 
1644
{
 
1645
    hdr_ptr x;
 
1646
 
 
1647
    if (r->proto_num < 1001) {
 
1648
        /* don't send interim response to HTTP/1.0 Client */
 
1649
        return;
 
1650
    }
 
1651
    if (!ap_is_HTTP_INFO(r->status)) {
 
1652
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, NULL,
 
1653
                      "Status is %d - not sending interim response", r->status);
 
1654
        return;
 
1655
    }
 
1656
 
 
1657
    x.f = r->connection->output_filters;
 
1658
    x.bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
 
1659
    ap_fputstrs(x.f, x.bb, AP_SERVER_PROTOCOL, " ", r->status_line, CRLF, NULL);
 
1660
    if (send_headers) {
 
1661
        apr_table_do(send_header, &x, r->headers_out, NULL);
 
1662
        apr_table_clear(r->headers_out);
 
1663
    }
 
1664
    ap_fputs(x.f, x.bb, CRLF);
 
1665
    ap_fflush(x.f, x.bb);
 
1666
    apr_brigade_destroy(x.bb);
 
1667
}
 
1668
 
1636
1669
AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request,
1637
1670
                          (request_rec *r), (r), OK, DECLINED)
1638
1671
AP_IMPLEMENT_HOOK_RUN_ALL(int,log_transaction,