Made both JunkBuster projects depend on vc_dftables, so it is built
[privoxy.git] / jbsockets.c
index bcbd818..5651d48 100644 (file)
@@ -1,4 +1,4 @@
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.9 2001/06/07 23:06:09 jongfoster Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.11 2001/06/29 21:45:41 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
@@ -35,6 +35,14 @@ const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.9 2001/06/07 23:06:09 jongfos
  *
  * Revisions   :
  *    $Log: jbsockets.c,v $
+ *    Revision 1.11  2001/06/29 21:45:41  oes
+ *    Indentation, CRLF->LF, Tab-> Space
+ *
+ *    Revision 1.10  2001/06/29 13:29:15  oes
+ *    - Added remote (server) host IP to csp->http->host_ip_addr_str
+ *    - Added detection of local socket IP and fqdn
+ *    - Removed logentry from cancelled commit
+ *
  *    Revision 1.9  2001/06/07 23:06:09  jongfoster
  *    The host parameter to connect_to() is now const.
  *
@@ -143,7 +151,7 @@ int connect_to(const char *host, int portnum, struct client_state *csp)
 
    if ((addr = resolve_hostname_to_ip(host)) == -1)
    {
-          csp->http->host_ip_addr_str = strdup("unknown");
+      csp->http->host_ip_addr_str = strdup("unknown");
       return(-1);
    }
 
@@ -438,7 +446,6 @@ int accept_connection(struct client_state * csp, int fd)
    struct sockaddr_in *lap = (struct sockaddr_in *) &laddr;
    struct hostent *host = NULL;
    int   afd, raddrlen, laddrlen;
-   extern int h_errno;
    char *p;
 
    raddrlen = sizeof raddr;
@@ -457,25 +464,26 @@ int accept_connection(struct client_state * csp, int fd)
     * and the hostname associated with that address
     */
    if (!getsockname(afd, &laddr, &laddrlen))
-       {
+   {
       csp->my_ip_addr_str = strdup(inet_ntoa(lap->sin_addr));
 
       host = gethostbyaddr(laddr.sa_data + 2, 4, AF_INET);
       if (host == NULL)
       {
-         log_error(LOG_LEVEL_ERROR, "Unable to get my own hostname: %s\n", hstrerror(h_errno)); 
+         log_error(LOG_LEVEL_ERROR, "Unable to get my own hostname: %E\n");
       }
       else
-          {
+      {
          csp->my_hostname = strdup(host->h_name);
       }
-       }
+   }
 
    csp->cfd    = afd;
    csp->ip_addr_str  = strdup(inet_ntoa(rap->sin_addr));
    csp->ip_addr_long = ntohl(rap->sin_addr.s_addr);
 
    return 1;
+
 }