-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.87 2011/03/27 13:55:55 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.91 2011/03/27 13:57:28 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
* OS-independent. Contains #ifdefs to make this work
* on many platforms.
*
- * Copyright : Written by and Copyright (C) 2001-2010 the
+ * Copyright : Written by and Copyright (C) 2001-2011 the
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
/* Don't leak memory when retrying. */
freez(csp->error_message);
+ freez(csp->http->host_ip_addr_str);
retval = snprintf(service, sizeof(service), "%d", portnum);
if ((-1 == retval) || (sizeof(service) <= retval))
continue;
}
+ fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
#ifdef _WIN32
- if ((fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) ==
- JB_INVALID_SOCKET)
+ if (fd == JB_INVALID_SOCKET)
#else
- if ((fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) < 0)
+ if (fd < 0)
#endif
{
continue;
connect_failed = 0;
while (connect(fd, rp->ai_addr, rp->ai_addrlen) == JB_INVALID_SOCKET)
{
+#ifdef __OS2__
+ errno = sock_errno();
+#endif /* __OS2__ */
+
#ifdef _WIN32
if (errno == WSAEINPROGRESS)
-#elif __OS2__
- if (sock_errno() == EINPROGRESS)
#else /* ifndef _WIN32 */
if (errno == EINPROGRESS)
#endif /* ndef _WIN32 || __OS2__ */
break;
}
-#ifdef __OS2__
- if (sock_errno() != EINTR)
-#else
if (errno != EINTR)
-#endif /* __OS2__ */
{
close_socket(fd);
connect_failed = 1;
}
#endif /* ndef _WIN32 */
+ fd = socket(inaddr.sin_family, SOCK_STREAM, 0);
#ifdef _WIN32
- if ((fd = socket(inaddr.sin_family, SOCK_STREAM, 0)) == JB_INVALID_SOCKET)
+ if (fd == JB_INVALID_SOCKET)
#else
- if ((fd = socket(inaddr.sin_family, SOCK_STREAM, 0)) < 0)
+ if (fd < 0)
#endif
{
return(JB_INVALID_SOCKET);