/[winpt]/trunk/Src/wptKeyserver.cpp
ViewVC logotype

Diff of /trunk/Src/wptKeyserver.cpp

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

revision 195 by twoaday, Mon Apr 3 17:10:47 2006 UTC revision 200 by twoaday, Mon Apr 17 09:12:50 2006 UTC
# Line 1  Line 1 
1  /* wptKeyserver.cpp - W32 Keyserver Access  /* wptKeyserver.cpp - W32 Keyserver Access
2   *      Copyright (C) 2000-2005 Timo Schulz   *      Copyright (C) 2000-2006 Timo Schulz
3   *      Copyright (C) 2001 Marco Cunha   *      Copyright (C) 2001 Marco Cunha
4   *   *
5   * This file is part of WinPT.   * This file is part of WinPT.
# Line 37  Line 37 
37  #include "wptGPG.h"  #include "wptGPG.h"
38  #include "wptRegistry.h"  #include "wptRegistry.h"
39    
40  /* just map net_errno to a winsock error. */  /* Map net_errno to a winsock error. */
41  #define net_errno ((int)WSAGetLastError ())  #define net_errno ((int)WSAGetLastError ())
42    
43    
# Line 660  kserver_load_conf (const char *conf) Line 660  kserver_load_conf (const char *conf)
660     Return value: 0 on success */     Return value: 0 on success */
661  int  int
662  kserver_connect (const char *hostname, WORD port, int *conn_fd)  kserver_connect (const char *hostname, WORD port, int *conn_fd)
663  {  {        
     int rc, fd;  
     DWORD iaddr;  
     char host[128] = {0};  
664      struct hostent *hp;      struct hostent *hp;
665      struct sockaddr_in sock;      struct sockaddr_in sock;
666        char host[128] = {0};
667        DWORD iaddr;
668        int rc, fd;
669    
670      log_debug ("kserver_connect: %s:%d\r\n", hostname, port);      log_debug ("kserver_connect: %s:%d\r\n", hostname, port);
671    
# Line 675  kserver_connect (const char *hostname, W Line 675  kserver_connect (const char *hostname, W
675          *conn_fd = 0;          *conn_fd = 0;
676      hostname = skip_type_prefix (hostname);      hostname = skip_type_prefix (hostname);
677            
678        if (proxy.host && proxy.proto == PROXY_PROTO_HTTP)
679            port = proxy.port;
680      memset (&sock, 0, sizeof (sock));      memset (&sock, 0, sizeof (sock));
681      sock.sin_family = AF_INET;      sock.sin_family = AF_INET;
682      sock.sin_port = proxy.host? htons (proxy.port) : htons (port);      sock.sin_port = htons (port);
683      if (proxy.host)      if (proxy.host)
684          strncpy (host, proxy.host, 127);          strncpy (host, proxy.host, 127);
685      else      else
686          strncpy (host, hostname, 127);          strncpy (host, hostname, 127);
687        
688      if ((iaddr = inet_addr (host)) != INADDR_NONE)      if ((iaddr = inet_addr (host)) != INADDR_NONE)
689          memcpy (&sock.sin_addr, &iaddr, sizeof (iaddr));          memcpy (&sock.sin_addr, &iaddr, sizeof (iaddr));
690      else if ((hp = gethostbyname (host))) {      else if ((hp = gethostbyname (host))) {

Legend:
Removed from v.195  
changed lines
  Added in v.200

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26