changeset 268:f8a29745247c

[gaim-migrate @ 278] Two star college football players need to pass the final to play in the big game. The professor loves football, but knows these guys aren't the brightest bulbs in teh box, so he gives them a special final, puts them in a room by themselves, and gives them an hour. The guys look at each other, and start in on the final, which has only one question: "What did Old MacDonald have?" One guy looks at the other and says, "Do you know the answer to this?" The other guy says, "Duh, a farm." "How do you spell that?" "Stupid! EIEIO!" committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 25 May 2000 18:58:21 +0000
parents 5c19f91e7ce4
children 46b6b894bc48
files src/html.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/html.c	Thu May 25 08:37:29 2000 +0000
+++ b/src/html.c	Thu May 25 18:58:21 2000 +0000
@@ -101,11 +101,11 @@
 	char *webdata = NULL;
         int sock;
         int len;
+	int read_rv;
 	int datalen = 0;
 	struct in_addr *host;
 	char buf[256];
 	char data;
-        FILE *sockfile;
         int startsaving = 0;
         GtkWidget *pw = NULL, *pbar = NULL, *label;
 
@@ -123,17 +123,20 @@
 	if ((sock = connect_address(host->s_addr, website.port)) < 0)
 		return g_strdup("g003: Error opening connection.\n");
 
-	sockfile = fdopen(sock, "r+");
-
 	g_snprintf(buf, sizeof(buf), "GET /%s HTTP/1.0\n\n", website.page);
 	g_snprintf(debug_buff, sizeof(debug_buff), "Request: %s\n", buf);
 	debug_print(debug_buff);
-	fputs(buf, sockfile);
+	write(sock, buf, strlen(buf));
 
         webdata = NULL;
         len = 0;
 	
+	/*
+	 * avoid fgetc(), it causes problems on solaris
 	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) {
 		if (!data)
 			continue;