Hello *,

in my apache module (written in C) are sended data to the client side over
buckets and brigades.
Function for send these date is:
apr_status_t send_data_to_client(request_rec *r, char * data_to_send, int
length_data)
{
    apr_bucket_brigade * bb =
apr_brigade_create(r->pool,r->connection->bucket_alloc);
    apr_bucket * b =
apr_bucket_immortal_create(data_to_send,length_data,r->connection->bucket_alloc);
    APR_BRIGADE_INSERT_TAIL(bb,b);
    ap_pass_brigade(r->connection->output_filters,bb);
    return OK;
}

It is working but in the traces of application which receive the data from
apache module the HTTP data are in reverse order.
First are received data and then is received HTTP header. Do you know how to
switch this order to the normal state, first is sended HTTP header and
afterwards are sended data?

Before when the data are send is following code:

    r->content_type = "text/plain";

    bodylen = strlen(response_body);
    ap_set_content_length(r, bodylen);

    ap_send_http_header(r);

    if (r->header_only)
    {
        ap_log_error(APLOG_MARK,APLOG_NOERRNO | APLOG_DEBUG, 0, r->server,
"HEADER ONLY");
        return OK;
    }
    send_data_to_client(r,response_body, bodylen);


best regards
Petr

Reply via email to