httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "RCHAPACH Rochester" <rchap...@us.ibm.com>
Subject Re: [PATCH] mod_autoindex HeaderName/ReadmeName content_type
Date Wed, 29 Aug 2001 15:32:41 GMT

Yes, I understand that this would solve the problem.  My thought is if
there wasn't an AddType, shouldn't we be trying to use the default type?
If the default type is good enough to use when serving the README directly,
why not when serving it up for directory browsing?

Rob Simonson
simo@us.ibm.com


"William A. Rowe, Jr." <wrowe@rowe-clan.net> on 08/29/2001 09:07:55 AM

Please respond to dev@httpd.apache.org

To:   <dev@httpd.apache.org>
cc:
Subject:  Re: [PATCH] mod_autoindex HeaderName/ReadmeName content_type



This is a wee bit to hackish.  Proper configuration of the files is more
appropriate.  On Apache 1.3, I believe the hack that works is

AddType /README text/plain
AddType /HEADER text/plain

Please don't ask why this should work ... is just does ;)

Give it a shot, let us know if it solves your problem without hassle.

Bill

----- Original Message -----
From: "Robert Simonson" <simo@us.ibm.com>
To: <dev@httpd.apache.org>
Sent: Wednesday, August 29, 2001 8:41 AM
Subject: [PATCH] mod_autoindex HeaderName/ReadmeName content_type


> This patch is to set the content_type to the default if the subrequest
> request_rec content_type is NULL.
>
> Rob Simonson
> simo@us.ibm.com
>
> ==========================================================
> --- mod_autoindex.c.asfsave.c Wed Aug 29 08:29:17 2001
> +++ mod_autoindex.c Wed Aug 29 08:32:15 2001
> @@ -999,49 +999,49 @@
>      && (rr->status == HTTP_OK)
>      && (rr->filename != NULL)
>      && rr->finfo.filetype == APR_REG) {
> +        if (rr->content_type == NULL)
> +            rr->content_type = ap_default_type(rr);
>      /*
>       * Check for the two specific cases we allow: text/html and
>       * text/anything-else.  The former is allowed to be processed for
>       * SSIs.
>       */
> -    if (rr->content_type != NULL) {
> -        if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type),
> -                  "text/html")) {
> -         /* Hope everything will work... */
> -         emit_amble = 0;
> -         emit_H1 = 0;
> +        if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type),
> +                        "text/html")) {
> +            /* Hope everything will work... */
> +            emit_amble = 0;
> +            emit_H1 = 0;
>
> -         if (! suppress_amble) {
> -             emit_preamble(r, title);
> -         }
> -         /*
> -          * If there's a problem running the subrequest, display the
> -          * preamble if we didn't do it before -- the header file
> -          * didn't get displayed.
> -          */
> -         if (ap_run_sub_req(rr) != OK) {
> -             /* It didn't work */
> -             emit_amble = suppress_amble;
> -             emit_H1 = 1;
> -         }
> -        }
> -        else if (!strncasecmp("text/", rr->content_type, 5)) {
> -         /*
> -          * If we can open the file, prefix it with the preamble
> -          * regardless; since we'll be sending a <pre> block around
> -          * the file's contents, any HTML header it had won't end up
> -          * where it belongs.
> -          */
> -         if (apr_file_open(&f, rr->filename, APR_READ,
> -                            APR_OS_DEFAULT, r->pool) == APR_SUCCESS) {
> -             emit_preamble(r, title);
> -             emit_amble = 0;
> -             do_emit_plain(r, f);
> -             apr_file_close(f);
> -             emit_H1 = 0;
> -         }
> -        }
> -    }
> +            if (! suppress_amble) {
> +                emit_preamble(r, title);
> +            }
> +            /*
> +             * If there's a problem running the subrequest, display the
> +             * preamble if we didn't do it before -- the header file
> +             * didn't get displayed.
> +             */
> +            if (ap_run_sub_req(rr) != OK) {
> +                /* It didn't work */
> +                emit_amble = suppress_amble;
> +                emit_H1 = 1;
> +            }
> +        }
> +        else if (!strncasecmp("text/", rr->content_type, 5)) {
> +            /*
> +             * If we can open the file, prefix it with the preamble
> +             * regardless; since we'll be sending a <pre> block around
> +             * the file's contents, any HTML header it had won't end up
> +             * where it belongs.
> +             */
> +            if (apr_file_open(&f, rr->filename, APR_READ,
> +                              APR_OS_DEFAULT, r->pool) == APR_SUCCESS) {
> +                emit_preamble(r, title);
> +                emit_amble = 0;
> +                do_emit_plain(r, f);
> +                apr_file_close(f);
> +                emit_H1 = 0;
> +            }
> +        }
>      }
>
>      if (emit_amble) {
> @@ -1082,32 +1082,32 @@
>      && (rr->status == HTTP_OK)
>      && (rr->filename != NULL)
>      && rr->finfo.filetype == APR_REG) {
> +        if (rr->content_type == NULL)
> +            rr->content_type = ap_default_type(rr);
>      /*
>       * Check for the two specific cases we allow: text/html and
>       * text/anything-else.  The former is allowed to be processed for
>       * SSIs.
> -     */
> -    if (rr->content_type != NULL) {
> -        if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type),
> -                  "text/html")) {
> -         if (ap_run_sub_req(rr) == OK) {
> -             /* worked... */
> -             suppress_sig = 1;
> -             suppress_post = suppress_amble;
> -         }
> -        }
> -        else if (!strncasecmp("text/", rr->content_type, 5)) {
> -         /*
> -          * If we can open the file, suppress the signature.
> -          */
> -         if (apr_file_open(&f, rr->filename, APR_READ,
> -                            APR_OS_DEFAULT, r->pool) == APR_SUCCESS) {
> -             do_emit_plain(r, f);
> -             apr_file_close(f);
> -             suppress_sig = 1;
> -         }
> -        }
> -    }
> +         */
> +        if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type),
> +                        "text/html")) {
> +            if (ap_run_sub_req(rr) == OK) {
> +                /* worked... */
> +                suppress_sig = 1;
> +                suppress_post = suppress_amble;
> +            }
> +        }
> +        else if (!strncasecmp("text/", rr->content_type, 5)) {
> +            /*
> +             * If we can open the file, suppress the signature.
> +             */
> +            if (apr_file_open(&f, rr->filename, APR_READ,
> +                              APR_OS_DEFAULT, r->pool) == APR_SUCCESS) {
> +                do_emit_plain(r, f);
> +                apr_file_close(f);
> +                suppress_sig = 1;
> +            }
> +        }
>      }
>
>      if (!suppress_sig) {
>
>
>





Mime
View raw message