httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@imdb.com (Rob Hartill)
Subject mod_actions.c handles DefaultType "incorrectly" (fwd)
Date Sun, 16 Jun 1996 00:30:45 GMT

not acked.


Date: Sat, 15 Jun 1996 17:38:03 -0500
Message-Id: <199606152238.RAA13837@pluto.mixi.net>
From: "Todd R. Eigenschink" <eigenstr@pluto.mixi.net>
To: apache-bugs@apache.org
Subject: mod_actions.c handles DefaultType "incorrectly"

I've come across what I would call a bug in mod_actions.c in Apache
1.1b[23] (Linux, although I'd expect the same problem on all host
types).  If not a bug, I'd call it a design misfeature.

For an application I'm working on, I'd like files with no extension in
a certain directory to be treated as application/x-httpd-newsarticle.
They should be processed with a given script that will add a header
and footer.

I used the following .htaccess:

    DefaultType application/x-httpd-newsarticle
    Action      application/x-httpd-newsarticle   /cgi-bin/news/index.pl


When I tried to load one of the files, I'd get a Save As dialog from
Netscape, and it would know that the content-type was
application/x-httpd-newsarticle.  So why wasn't the script being run?

It took a while, but I learned a lot about Apache modules in the
process of figuring it out.

Since the default type is just that--a default value--the content_type
field of the request_rec struct is not being set.  invoke_handler()
uses the content_type field if it's present, and if not, uses
default_type(r), where r is the request_rec.

The handler for the action module catches */*, and then goes searching
through it's own handlers, looking only at the content_type field.
Since r->content_type is NULL, nothing ever matches.  I modified one
line (well, two) in mod_actions.c so that default content types would
be processed correctly.


Is this a bug, or a conscious decision?


Here's a patch.

*** mod_actions.c	Sat Jun 15 12:27:05 1996
--- mod_actions.c.orig	Sat Jun 15 12:25:33 1996
***************
*** 171,178 ****
          return DECLINED;
  
      /* Second, check for actions (which override the method scripts) */
!     if (action && (t = table_get(conf->action_types,
! 				 action ? action : default_type(r)))) {
          script = t;
  	if (r->finfo.st_mode == 0) {
  	    log_reason("File does not exist", r->filename, r);
--- 171,177 ----
          return DECLINED;
  
      /* Second, check for actions (which override the method scripts) */
!     if (action && (t = table_get(conf->action_types, action))) {
          script = t;
  	if (r->finfo.st_mode == 0) {
  	    log_reason("File does not exist", r->filename, r);



Todd
--
Todd R. Eigenschink		Midwest Internet Exchange, Inc.
eigenstr@mixi.net		http://www.mixi.net/
System Manager			(219) 483-2040

----- End of forwarded message from Todd R. Eigenschink -----

-- 
Rob Hartill (robh@imdb.com)
The Internet Movie Database (IMDb)  http://www.imdb.com/
           ...more movie info than you can poke a stick at.

Mime
View raw message