httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Sutton <p...@ukweb.com>
Subject Configurable nph filenames
Date Thu, 11 Jul 1996 10:11:59 GMT
For historic reasons, NPH scripts _have_ to be named nph-something. This
isn't as configurable as the rest of Apache. I've written a small patch
which lets users configure nph scripts just as they do standard cgi. For
example, to treat the extension .nph has a cgi script, use

  AddHandler nph-handler nph

The match adds a new handler nph-handler to mod_cgi, which forces the
script to be interpreted as NPH. Otherwise the old behaviour remains
(checking the first four chars of the filename).

Paul Sutton
UK Web Ltd

---



*** mod_cgi.c.dist      Thu Jul 11 12:01:16 1996
--- mod_cgi.c   Thu Jul 11 12:05:15 1996
***************
*** 204,212 ****
      exit(0);
  }

! int cgi_handler (request_rec *r)
  {
-     int nph;
      char *argv0;
      FILE *script_out, *script_in;
      char argsbuffer[HUGE_STRING_LEN];
--- 204,211 ----
      exit(0);
  }

! int cgi_handler_internal (request_rec *r, int nph)
  {
      char *argv0;
      FILE *script_out, *script_in;
      char argsbuffer[HUGE_STRING_LEN];
***************
*** 219,226 ****
          argv0++;
      else argv0 = r->filename;

!     nph = !(strncmp(argv0,"nph-",4));
!
      if (!(allow_options (r) & OPT_EXECCGI) && !is_scriptaliased (r)) {
          log_reason("Options ExecCGI is off in this directory", r->filename, r
);
        return FORBIDDEN;
--- 218,226 ----
          argv0++;
      else argv0 = r->filename;

!     if (!nph)
!         nph = !(strncmp(argv0,"nph-",4));
!
      if (!(allow_options (r) & OPT_EXECCGI) && !is_scriptaliased (r)) {
          log_reason("Options ExecCGI is off in this directory", r->filename, r
);
        return FORBIDDEN;
***************
*** 387,395 ****
--- 387,406 ----
      return OK;                        /* NOT r->status, even if it has change
d. */
  }

+ int cgi_handler (request_rec *r)
+ {
+     return cgi_handler_internal(r, 0);
+ }
+
+ int nph_handler (request_rec *r)
+ {
+     return cgi_handler_internal(r, 1);
+ }
+
  handler_rec cgi_handlers[] = {
  { CGI_MAGIC_TYPE, cgi_handler },
  { "cgi-script", cgi_handler },
+ { "nph-script", nph_handler },
  { NULL }
  };





Mime
View raw message