So upset about this. I am trying to do a very simple thing here.
I try to insert a string at the head of a html file in an Apache module, the code is simple.
apr_bucket* txt_esc(apr_bucket_alloc_t* alloc )
{
return apr_bucket_transient_create("ggggggggggggggg", 15, alloc) ;
}
apr_status_t add_string(ap_filter_t *f, apr_bucket_brigade *pbbIn)
{
APR_BRIGADE_INSERT_HEAD(pbbIn, txt_esc(f->r->connection->bucket_alloc));
return ap_pass_brigade(f->next, pbbIn);
}
The problem is that I can insert the string at the head, but meantime, the content of the same size of the string at the end of the html file will be truncated.
Anybody knows why this happens? This Apache server is running as a proxy.