comparison 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
comparison
equal deleted inserted replaced
277:bba300ed4fab 278:29e1669b006b
30 #include "gaim.h" 30 #include "gaim.h"
31 #include <sys/types.h> 31 #include <sys/types.h>
32 #include <sys/socket.h> 32 #include <sys/socket.h>
33 #include <netdb.h> 33 #include <netdb.h>
34 #include <netinet/in.h> 34 #include <netinet/in.h>
35 #include <fcntl.h>
36 #include <errno.h>
35 37
36 gchar * strip_html(gchar * text) 38 gchar * strip_html(gchar * text)
37 { 39 {
38 int i, j; 40 int i, j;
39 int visible = 1; 41 int visible = 1;
125 127
126 g_snprintf(buf, sizeof(buf), "GET /%s HTTP/1.0\n\n", website.page); 128 g_snprintf(buf, sizeof(buf), "GET /%s HTTP/1.0\n\n", website.page);
127 g_snprintf(debug_buff, sizeof(debug_buff), "Request: %s\n", buf); 129 g_snprintf(debug_buff, sizeof(debug_buff), "Request: %s\n", buf);
128 debug_print(debug_buff); 130 debug_print(debug_buff);
129 write(sock, buf, strlen(buf)); 131 write(sock, buf, strlen(buf));
132 fcntl(sock, F_SETFL, O_NONBLOCK);
130 133
131 webdata = NULL; 134 webdata = NULL;
132 len = 0; 135 len = 0;
133 136
134 /* 137 /*
135 * avoid fgetc(), it causes problems on solaris 138 * avoid fgetc(), it causes problems on solaris
136 while ((data = fgetc(sockfile)) != EOF) { 139 while ((data = fgetc(sockfile)) != EOF) {
137 */ 140 */
138 /* read_rv will be 0 on EOF and < 0 on error, so this should be fine */ 141 /* read_rv will be 0 on EOF and < 0 on error, so this should be fine */
139 while ((read_rv = read(sock, &data, 1)) > 0) { 142 while ((read_rv = read(sock, &data, 1)) > 0 || errno == EWOULDBLOCK) {
143 if (errno == EWOULDBLOCK) {
144 errno = 0;
145 continue;
146 }
147
140 if (!data) 148 if (!data)
141 continue; 149 continue;
142 150
143 if (!startsaving && data == '<') { 151 if (!startsaving && data == '<') {
144 #ifdef HAVE_STRSTR 152 #ifdef HAVE_STRSTR