We can probably have a generic API which returns the enable/disable flags in
bit pattern e.g
AP_DECLARE(int) ap_feature_enabled(request_rec *r);
// Caller :
int features = ap_feature_enabled(r);
if (features & SENDFILE_FLAG) // send file is enabled
if (features & MMAP_FLAG) // mmap is enabled
With this common API, we can add more flags in future.
Regards,
Basant.
On Thu, Sep 25, 2008 at 02:08:00PM -0400, Akins, Brian wrote:
> Got tired of having to set core_private for one bit of info. How does this
> look?
>
>
> Index: server/request.c
> ===================================================================
> --- server/request.c (revision 699033)
> +++ server/request.c (working copy)
> @@ -1907,3 +1907,14 @@
> return (r->main == NULL) /* otherwise, this is a sub-request */
> && (r->prev == NULL); /* otherwise, this is an internal
> redirect */
> }
> +
> +AP_DECLARE(int) ap_sendfile_enabled(request_rec *r)
> +{
> + int rc = 0;
> +#if APR_HAS_SENDFILE
> + core_dir_config *conf = ap_get_module_config(r->per_dir_config,
> + &core_module);
> + rc = conf->enable_sendfile == ENABLE_SENDFILE_OFF;
> +#endif
> + return rc;
> +}
> Index: include/httpd.h
> ===================================================================
> --- include/httpd.h (revision 699033)
> +++ include/httpd.h (working copy)
> @@ -1541,6 +1541,13 @@
> AP_DECLARE(int) ap_count_dirs(const char *path);
>
> /**
> + * Is sendfile enabled for this request
> + * @param r the current request
> + * @return 1 if enabled, 0 is not
> + */
> +AP_DECLARE(int) ap_sendfile_enabled(request_rec *r);
> +
> +/**
> * Copy at most @a n leading directories of @a s into @a d. @a d
> * should be at least as large as @a s plus 1 extra byte
> *
>
>
> --
> Brian Akins
> Chief Operations Engineer
> Turner Digital Media Technologies
>