httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@ai.mit.edu (Robert S. Thau)
Subject patch11.virt-srvr-name
Date Sun, 27 Aug 1995 12:26:35 GMT
This patch causes the names of virtual servers to default to something
like their proper values if not specified.

*** http_main.c	Sun Aug 27 09:16:45 1995
--- ../http_main.c	Sun Aug 27 12:00:03 1995
***************
*** 648,653 ****
--- 648,671 ----
      return server;
  }
  
+ void default_server_hostnames(server_rec *s)
+ {
+     /* Main host first */
+     
+     if (!s->server_hostname)
+ 	s->server_hostname = get_local_host(pconf);
+ 
+     /* Then virtual hosts */
+     
+     for (s = s->next; s; s = s->next)
+ 	if (!s->server_hostname) {
+ 	    struct hostent *h = gethostbyaddr ((char *)&(s->host_addr),
+ 					       sizeof (struct in_addr),
+ 					       AF_INET);
+ 	    s->server_hostname = pstrdup (pconf, h->h_name);
+ 	}
+ }
+ 	
  void abort_connection (conn_rec *c)
  {
      /* Make sure further I/O DOES NOT HAPPEN */
***************
*** 861,868 ****
      accept_mutex_init(pconf);
      reinit_scoreboard(pconf);
      
!     if (!server_conf->server_hostname)
!         server_conf->server_hostname = get_local_host(pconf);
  
      if ((sd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) == -1) {
          fprintf(stderr,"httpd: could not get socket\n");
--- 879,885 ----
      accept_mutex_init(pconf);
      reinit_scoreboard(pconf);
      
!     default_server_hostnames (server_conf);
  
      if ((sd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) == -1) {
          fprintf(stderr,"httpd: could not get socket\n");
***************
*** 984,991 ****
        
  	open_logs(server_conf, pconf);
  	set_group_privs();
! 	if (!server_conf->server_hostname)
! 	    server_conf->server_hostname = get_local_host(pconf);
  
          user_id = getuid();
          group_id = getgid();
--- 1001,1007 ----
        
  	open_logs(server_conf, pconf);
  	set_group_privs();
! 	default_server_hostnames (server_conf);
  
          user_id = getuid();
          group_id = getgid();

Mime
View raw message