/[hydra]/hydra/src/request.c
ViewVC logotype

Diff of /hydra/src/request.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.31 by nmav, Sat Oct 26 20:58:48 2002 UTC revision 1.32 by nmav, Sun Oct 27 08:15:25 2002 UTC
# Line 31  Line 31 
31  extern int boa_ssl;  extern int boa_ssl;
32  int system_bufsize = 0; /* Default size of SNDBUF given by system */  int system_bufsize = 0; /* Default size of SNDBUF given by system */
33    
34    inline
35    static void init_vhost_stuff( request* req, char* value);
36    
37  /* function prototypes located in this file only */  /* function prototypes located in this file only */
38  static void free_request( server_params* params, request ** list_head_addr,  static void free_request( server_params* params, request ** list_head_addr,
39          request * req);          request * req);
# Line 236  void get_request(server_params* params, Line 239  void get_request(server_params* params,
239    
240      ascii_sockaddr(&salocal, conn->local_ip_addr, NI_MAXHOST);      ascii_sockaddr(&salocal, conn->local_ip_addr, NI_MAXHOST);
241    
     if (default_document_root)  
        memcpy( conn->document_root, default_document_root, default_document_root_size + 1);  
   
242      /* nonblocking socket */      /* nonblocking socket */
243      if (set_nonblock_fd(conn->fd) == -1)      if (set_nonblock_fd(conn->fd) == -1)
244          WARN("fcntl: unable to set new socket to non-block");          WARN("fcntl: unable to set new socket to non-block");
# Line 272  void get_request(server_params* params, Line 272  void get_request(server_params* params,
272  #endif  #endif
273          }          }
274      }      }
275        
276        init_vhost_stuff(conn, "");
277    
278      /* for log file and possible use by CGI programs */      /* for log file and possible use by CGI programs */
279      ascii_sockaddr(&remote_addr, conn->remote_ip_addr, NI_MAXHOST);      ascii_sockaddr(&remote_addr, conn->remote_ip_addr, NI_MAXHOST);
# Line 872  static void init_vhost_stuff( request* r Line 874  static void init_vhost_stuff( request* r
874                
875         vhost = find_virthost( value, valuelen);         vhost = find_virthost( value, valuelen);
876    
877           if (vhost == NULL && value[0]!=0) {
878              value = "";
879              vhost = find_virthost( "", 0);
880           }
881    
882         if ( vhost && ( vhost->ip == NULL || !memcmp( vhost->ip, req->local_ip_addr, vhost->ip_len) ))         if ( vhost && ( vhost->ip == NULL || !memcmp( vhost->ip, req->local_ip_addr, vhost->ip_len) ))
883         {         {
884            req->hostname = value;            req->hostname = value;
# Line 879  static void init_vhost_stuff( request* r Line 886  static void init_vhost_stuff( request* r
886            if (vhost->user_dir)            if (vhost->user_dir)
887               memcpy( req->user_dir, vhost->user_dir, vhost->user_dir_len + 1);               memcpy( req->user_dir, vhost->user_dir, vhost->user_dir_len + 1);
888    
        } else { /* No virtual host found. use defaults */  
           if ( default_document_root)  
              memcpy( req->document_root, default_document_root, default_document_root_size + 1);  
889         }         }
890    
891  }  }

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26