> -------------------------------------------------------------------------------------------------------------------------------
> HERE IS:
> #include <httpd.h>
> #include <http_config.h>
> #include <http_protocol.h>
> #include <http_request.h>
> #include <http_log.h>
> #include <ap_compat.h>
> #include <apr_buckets.h>
> #include <apr_strings.h>
>
>
> #define ASE_FILE_SIZE 512000
> #define ASE_BUFFER_SIZE 104858
>
> module AP_MODULE_DECLARE_DATA ase_mod_module;
> #define ASE_MOD_HANDLER "ase-mod.extensions"
>
> static int ase_mod_handler(request_rec *r)
> {
> apr_status_t rv = APR_SUCCESS;
> apr_bucket_brigade* bb = NULL;;
> apr_bucket* b = NULL;;
> char filename[256];
>
> /* First, some housekeeping. */
> if (((!r->handler) != 0)|| (strcmp(r->handler, ASE_MOD_HANDLER)))
> {
> /* r->handler wasn't "ase_mod", so it's none of our business */
> ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,"Decline processing
> file %s is not %s and handler %s", r->filename,ASE_MOD_HANDLER,r->handler);
> return DECLINED;
> }
>
> if (r->method_number != M_GET)
> {
> ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,"Error
> METHOD_NOT_ALLOWED (%d)",r->method_number);
> return HTTP_METHOD_NOT_ALLOWED;
> }
>
> ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,"%s",r->the_request);
>
> // Construct filename
> strncpy(filename, r->filename, sizeof(filename) / sizeof(char) - 1);
> filename[sizeof(filename) / sizeof(char) - 1] = '\0';
>
> ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,"filename =
> %s",filename);
>
> int DataSize = ASE_FILE_SIZE;
>
> ap_set_content_type(r, "video/ase");
>
> ap_update_mtime(r, r->finfo.mtime);
> ap_set_last_modified(r);
>
> apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
>
> r->vlist_validator = apr_pstrcat(r->pool, "X",apr_itoa(r->pool, DataSize),
> "\"", NULL);
> ap_set_etag(r);
>
> char content_range[64];
> sprintf(content_range,"bytes %d-%d/%d",0,ASE_FILE_SIZE-1,ASE_FILE_SIZE);
> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,"Add content range
> %s",content_range);
> apr_table_setn(r->headers_out, "Content-Range",content_range);
>
> r->status = HTTP_OK;
>
> bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
> char* Buf;
> Buf = apr_palloc(r->pool,ASE_BUFFER_SIZE);
> int size = ASE_BUFFER_SIZE;
>
> unsigned int count = 0;
> while(DataSize>0)
> {
> if((DataSize - size)<0)
> {
> size = DataSize;
> }
>
> memset(Buf,count,size);
>
> b = apr_bucket_pool_create(Buf ,size, r->pool,
> r->connection->bucket_alloc) ;
>
> APR_BRIGADE_INSERT_TAIL(bb, b);
> APR_BRIGADE_INSERT_TAIL(bb,apr_bucket_flush_create(bb->bucket_alloc));
>
> if(DataSize <= size)
> {
>
> APR_BRIGADE_INSERT_TAIL(bb,apr_bucket_eos_create(bb->bucket_alloc));
> ap_log_error(APLOG_MARK, APLOG_INFO, 0,
> r->server,"APR_BRIGADE_INSERT_TAIL EOS Bucket");
> }
>
> rv = ap_pass_brigade(r->output_filters, bb);
>
> if (rv != APR_SUCCESS)
> {
> ap_log_error(APLOG_MARK, APLOG_ERR, 0,
> r->server,"HTTP_INTERNAL_SERVER_ERROR ap_pass_brigade ");
> r->status = HTTP_INTERNAL_SERVER_ERROR;
> return r->status;
> }
>
> DataSize = DataSize - size;
> count++;
> ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,"ap_pass_brigade,
> DataSize = %d and Size = %d",DataSize, size );
>
> apr_brigade_cleanup(bb);
> }
>
> ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,"Out of While");
>
> apr_bucket_delete(b);
Try to remove this apr_bucket_delete from here. apr_brigade_cleanup in
the while loop deletes the buckets in the brigade. I think you delete
b twice.
Sorin