diff src/html.c @ 278:29e1669b006b

[gaim-migrate @ 288] check versions works (?) committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 29 May 2000 00:56:37 +0000
parents f8a29745247c
children b402a23f35df
line wrap: on
line diff
--- a/src/html.c	Sun May 28 22:09:30 2000 +0000
+++ b/src/html.c	Mon May 29 00:56:37 2000 +0000
@@ -32,6 +32,8 @@
 #include <sys/socket.h>
 #include <netdb.h>
 #include <netinet/in.h>
+#include <fcntl.h>
+#include <errno.h>
 
 gchar * strip_html(gchar * text)
 {
@@ -127,6 +129,7 @@
 	g_snprintf(debug_buff, sizeof(debug_buff), "Request: %s\n", buf);
 	debug_print(debug_buff);
 	write(sock, buf, strlen(buf));
+	fcntl(sock, F_SETFL, O_NONBLOCK);
 
         webdata = NULL;
         len = 0;
@@ -136,7 +139,12 @@
 	while ((data = fgetc(sockfile)) != EOF) {
 	*/
 	/* read_rv will be 0 on EOF and < 0 on error, so this should be fine */
-	while ((read_rv = read(sock, &data, 1)) > 0) {
+	while ((read_rv = read(sock, &data, 1)) > 0 || errno == EWOULDBLOCK) {
+		if (errno == EWOULDBLOCK) {
+			errno = 0;
+			continue;
+		}
+
 		if (!data)
 			continue;