[libsoup] Fix SSL on Windows



commit 55857a63ac93205321bb256ee35cd6801e671ee5
Author: Dan Winship <danw gnome org>
Date:   Sun Jul 12 20:26:43 2009 -0400

    Fix SSL on Windows
    
    The connection timeout changes had broken SSL on Windows because they
    used read/write rather than recv/send.
    
    Based on a patch from Fridrich Strba.
    http://bugzilla.gnome.org/show_bug.cgi?id=587910

 libsoup/soup-gnutls.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-gnutls.c b/libsoup/soup-gnutls.c
index 46b4188..947925f 100644
--- a/libsoup/soup-gnutls.c
+++ b/libsoup/soup-gnutls.c
@@ -390,8 +390,12 @@ soup_gnutls_pull_func (gnutls_transport_ptr_t transport_data,
 	SoupGNUTLSChannel *chan = transport_data;
 	ssize_t nread;
 
-	nread = read (chan->sockfd, buf, buflen);
+	nread = recv (chan->sockfd, buf, buflen, 0);
+#ifdef G_OS_WIN32
+	chan->eagain = (nread == SOCKET_ERROR && WSAGetLastError () == WSAEWOULDBLOCK);
+#else
 	chan->eagain = (nread == -1 && errno == EAGAIN);
+#endif
 	return nread;
 }
 
@@ -402,8 +406,12 @@ soup_gnutls_push_func (gnutls_transport_ptr_t transport_data,
 	SoupGNUTLSChannel *chan = transport_data;
 	ssize_t nwrote;
 
-	nwrote = write (chan->sockfd, buf, buflen);
+	nwrote = send (chan->sockfd, buf, buflen, 0);
+#ifdef G_OS_WIN32
+	chan->eagain = (nread == SOCKET_ERROR && WSAGetLastError () == WSAEWOULDBLOCK);
+#else
 	chan->eagain = (nwrote == -1 && errno == EAGAIN);
+#endif
 	return nwrote;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]