You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ha...@hyperreal.com> on 1996/02/27 15:37:04 UTC

CERN-related mods for Apache (fwd)

Hmmmmmm. If anyone is interested in these patches, please talk to the
submitter.

no ack.

Forwarded message:
> From tpg@zaphod.cfa.org  Mon Feb 26 15:10:35 1996
> Reply-to: tpg@cans.com
> Message-ID: <Il...@zaphod.cfa.org>
> Date: Mon, 26 Feb 1996 17:07:42 -0600 (CST)
> From: Terry Gliedt <tp...@zaphod.cfa.org>
> To: apache-bugs@apache.org
> Subject: CERN-related mods for Apache
> 
> Hope you find these of value.  I have so far :-)
> 
> 		Mods to the Apache 1.0.2 Server
> 
> Feb 1996
> 
> I maintain web servers on about 15 machines. Most are lightly
> loaded, from the Web perspective.  Some are sufficiently alike
> that I can use a single config file, but most have something
> unique about them. Some time ago they all started with they
> all used the CERN server.  Now it's time to move on to Apache.
> I created these modifications to ease my transition from CERN
> to the Apache server.
> 
> ===================== http_main.c =====================
> From:	   Terry Gliedt <tp...@cans.com>
> Subject:   Add "-s servername" to options for daemon
> Requires:  1.0.2 server
> Affects:   http_main.c
> Changelog: Add "-s servername" to options for daemon
> Comments: 
> For some reason I was not able to quickly determine, some
> of the machines I maintain could not figure out the Servername.
> I looked at this for a bit, then decided I needed it to work
> and could not depend on the machines being properly installed.
> So I added code for a "-s servername" option. All of my servers
> are started with a shell which does various housekeeping tasks
> and then starts the daemon. So adding the servername was a
> good choice for me.
> 
> diff -C3 src/http_main.c.orig src/http_main.c > optionS.patch
> 
> *** src/http_main.c.orig	Mon Jan 29 20:19:19 1996
> --- src/http_main.c	Fri Feb 16 11:24:52 1996
> ***************
> *** 108,113 ****
> --- 108,114 ----
>   
>   char server_root[MAX_STRING_LEN];
>   char server_confname[MAX_STRING_LEN];
> + char server_name[MAX_STRING_LEN];	/* tpg ServerName override */
>   
>   /* *Non*-shared http_main globals... */
>   
> ***************
> *** 667,673 ****
>   void default_server_hostnames(server_rec *s)
>   {
>       /* Main host first */
> !     
>       if (!s->server_hostname)
>   	s->server_hostname = get_local_host(pconf);
>   
> --- 668,676 ----
>   void default_server_hostnames(server_rec *s)
>   {
>       /* Main host first */
> !     if ( server_name[0] != '\0') {	/* tpg Servername overriden ? */
> ! 	s->server_hostname = &server_name;
> !     }			/* tpg End Servername overriden ? */
>       if (!s->server_hostname)
>   	s->server_hostname = get_local_host(pconf);
>   
> ***************
> *** 985,992 ****
>       server_argv0 = argv[0];
>       strcpy (server_root, HTTPD_ROOT);
>       strcpy (server_confname, SERVER_CONFIG_FILE);
>   
> !     while((c = getopt(argc,argv,"Xd:f:v")) != -1) {
>           switch(c) {
>             case 'd':
>               strcpy (server_root, optarg);
> --- 988,996 ----
>       server_argv0 = argv[0];
>       strcpy (server_root, HTTPD_ROOT);
>       strcpy (server_confname, SERVER_CONFIG_FILE);
> +     server_name[0]='\0';	/* tpg Insure no server name */
>   
> !     while((c = getopt(argc,argv,"Xd:f:s:v")) != -1) { /* tpg add 's' */
>           switch(c) {
>             case 'd':
>               strcpy (server_root, optarg);
> ***************
> *** 994,999 ****
> --- 998,1006 ----
>             case 'f':
>               strcpy (server_confname, optarg);
>               break;
> + 	  case 's':	/* tpg Force Servername */
> +             strcpy (server_name, optarg);
> + 	    break;	/* tpg End Force Servername */
>             case 'v':
>               printf("Server version %s.\n",SERVER_VERSION);
>               exit(1);
> 
> 
> 
> 
> ===================== mod_dir.c =====================
> From:	   Terry Gliedt <tp...@cans.com>
> Subject:   Support CERN style .www_browsable for indexing
> Requires:  1.0.2 server
> Affects:   mod_dir.c
> Changelog: If .www_browsable exists in a directory, then allow
> 	indexing.
> Comments: 
> The CERN server allows indexing to be disabled with a server
> flag (-ds). If .www_browsable exists in a directory, then
> indexing is allowed.  Since I had thousands of user directories
> with this in place, I really needed it.
> 
> This should probably be augmented with some sort of config
> keyword to enable this feature.
> 
> diff -C3 src/mod_dir.c.orig src/mod_dir.c > www_browsable.patch
> 
> *** src/mod_dir.c.orig	Sun Dec 17 08:32:29 1995
> --- src/mod_dir.c	Fri Feb 16 12:12:06 1996
> ***************
> *** 758,763 ****
> --- 758,766 ----
>   
>   /* The formal handler... */
>   
> + char *cern_p;	/* tpg Temp vars for CERN Index check */
> + struct stat cern_stat;
> + 
>   int handle_dir (request_rec *r)
>   {
>       dir_config_rec *d =
> ***************
> *** 796,804 ****
>           destroy_sub_req (rr);
>       }
>   
> !     /* OK, nothing easy.  Trot out the heavy artillery... */
>   
> !     if (allow_opts & OPT_INDEXES) 
>           return index_directory (r, d);
>       else
>           return FORBIDDEN;
> --- 799,812 ----
>           destroy_sub_req (rr);
>       }
>   
> !     /* tpg  Implement CERN index rule -- Index if .www_browsable found */
> !     cern_p = pstrcat (r->pool, r->filename, ".www_browsable", NULL);
> !     if ( (stat(cern_p, &cern_stat)) == 0 ) {
> !         return index_directory (r, d);
> !     }	/* tpg End CERN index rule */
>   
> !     /* OK, nothing easy.  Trot out the heavy artillery... */
> !     if (allow_opts & OPT_INDEXES)
>           return index_directory (r, d);
>       else
>           return FORBIDDEN;
> 
> 
> 
> 
> ===================== mod_imap.c =====================
> From:	   Terry Gliedt <tp...@cans.com>
> Subject:   Support CERN image maps
> Requires:  1.0.2 server
> Affects:   mod_imap.c
> Changelog: Support CERN image maps in addition to NCSA style
> 
> Comments: 
> CERN & NCSA image maps have the same information:
> 	rect http:blahblah x,y x1,y1	(NCSA format)
> 	rect (x,y) (x1,y1) http:blahblah (CERN format)
> 
> The mod simply looks for a "(" and then, assuming the
> format is correct, rearranges the line (internally) to
> look like an NCSA line. 
> 
> This code should probably have a bit of error checking added
> so if the parenthesies are not all there, the server does
> not die.
> 
> diff -C3 src/mod_imap.c.orig src/mod_imap.c > CERNmaps.patch
> 
> *** src/mod_imap.c.orig	Sun Dec 17 08:32:29 1995
> --- src/mod_imap.c	Thu Feb 15 11:07:17 1996
> ***************
> *** 305,313 ****
>   
>   	while (isspace(input[i])) ++i;
>   
> ! 	for (j = 0; input[i] && !isspace(input[i]); ++i,++j)
>   	    mapurl[j] = input[i];
> ! 	mapurl[j] = '\0';
>   
>   	if (!strcmp (maptype, "base_uri")) {
>   	
> --- 305,333 ----
>   
>   	while (isspace(input[i])) ++i;
>   
> ! 	/* TPG  Second field is either a "(" meaning it is a CERN map, or it
> is a URL */
> ! 	if (input[i] == '(') {	/* CERN format here */
> ! 	    /* Move over all the (x,y) pairs removing ( and ) */
> ! 	    for (k=i; input[k]; ++k) {
> ! 		if (input[k] == '(') input[k]=' ';
> ! 		if (input[k] == ')') input[k]=' ';
> ! 	    }
> ! 	    k=i;		/* Find URL */
> ! 	    while (input[k]!='/' && input[k]<='9') ++k;
> ! 	    input[k-1] = '\0';	/* Start of URL is end of x,y pairs, end of string */
> ! 	    /* Find URL and copy it to mapurl */
> ! 	    for (j = 0; input[k] && !isspace(input[k]); ++k,++j)
> ! 		mapurl[j] = input[k];
> ! 	    mapurl[j] = '\0';
> ! 	    i++;	/* Note that "I" is now at start of x,y pairs */
> ! 	}
> ! 	else {			/* NCSA format here */
> ! 	    /* Get the URL.  The variable "i" is start of coordinates. */
> ! 	    for (j = 0; input[i] && !isspace(input[i]); ++i,++j)
>   	    mapurl[j] = input[i];
> ! 	    mapurl[j] = '\0';
> ! 	}
> ! 	/* TPG  End of mod to handle both NCSA and CERN maps */
>   
>   	if (!strcmp (maptype, "base_uri")) {
>   	
> ===============================================================
> 
> ===================================================================
> Terry Gliedt      tpg@cans.com         MIME OK         507/356-4512
> Web Programmer: http://www.cfa.org/        http://www.cfa.org/~tpg/
>