} php_struct;
typedef struct _php_apr_bucket_brigade {
- unsigned int total_len;
apr_bucket_brigade *bb;
} php_apr_bucket_brigade;
extern const command_rec php_dir_cmds[];
static size_t php_apache_read_stream(void *, char *, size_t TSRMLS_DC);
-static void php_apache_close_stream(void * TSRMLS_DC);
-static long php_apache_fteller_stream(void * TSRMLS_DC);
+static size_t php_apache_fsizer_stream(void * TSRMLS_DC);
#define APR_ARRAY_FOREACH_OPEN(arr, key, val) \
{ \
php_struct *ctx = SG(server_context);
const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env);
char *key, *val;
- int new_val_len;
+ unsigned int new_val_len;
APR_ARRAY_FOREACH_OPEN(arr, key, val)
if (!val) {
} else {
pbb = f->ctx = apr_palloc(f->r->pool, sizeof(*pbb));
pbb->bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
- pbb->total_len = 0;
}
if(ap_save_brigade(NULL, &pbb->bb, &bb, f->r->pool) != APR_SUCCESS) {
zfd.handle.stream.handle = pbb;
zfd.handle.stream.reader = php_apache_read_stream;
- zfd.handle.stream.closer = php_apache_close_stream;
- zfd.handle.stream.fteller = php_apache_fteller_stream;
- zfd.handle.stream.interactive = 0;
+ zfd.handle.stream.closer = NULL;
+ zfd.handle.stream.fsizer = php_apache_fsizer_stream;
+ zfd.handle.stream.isatty = 0;
zfd.filename = f->r->filename;
zfd.opened_path = NULL;
readlen = wantlen;
apr_brigade_flatten(rbb, buf, &readlen);
apr_brigade_cleanup(rbb);
- pbb->total_len += readlen;
return readlen;
}
-static void php_apache_close_stream(void *handle TSRMLS_DC)
-{
- return;
-}
-
-static long php_apache_fteller_stream(void *handle TSRMLS_DC)
+static size_t php_apache_fsizer_stream(void *handle TSRMLS_DC)
{
php_apr_bucket_brigade *pbb = (php_apr_bucket_brigade *)handle;
- return pbb->total_len;
+ apr_off_t actual = 0;
+
+ if (apr_brigade_length(pbb->bb, 1, &actual) == APR_SUCCESS) {
+ return actual;
+ }
+
+ return 0;
}
AP_MODULE_DECLARE_DATA module php5_module = {